From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D25AD82883 for ; Mon, 29 Apr 2024 15:53:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714406029; cv=none; b=FCIjQ4BvTGtILMqRkB/ZR6pTtnTSmieWPSzotgqIFb5m7d92U3yuaHsotf8+R6hTSIqXnNQ4t1k/XR16fXX7Dkw4owqYWRfTZf0EoR2u8AkSKdSmT/OGbhwKN6pb6ofanJUay9INDDxfy4uooBJwWvTmtuFhi/i96zcfOa4O0X8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714406029; c=relaxed/simple; bh=NsRBY74Bfg5heYt2w1gPVTY1zYEHG1o7HaSNvAT0veY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=QkYxi8mG+jgFJkIdF9Yw5eq/dBfWfxiFUWrrJ9N2u0JSX6h1JzNJlIYNEh6RaXscfAxQylPG1IDV+e7hqcH7U6Lxa4D4AVdgiTcDYiSZANeCRbVhx81LougAvsPXvxChDf7o7MGls33/eL/vXfooGKK4D3/A7hudAU2zaTVQid0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=la50SNEx; arc=none smtp.client-ip=95.215.58.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="la50SNEx" Message-ID: <7eddbfd3-2acd-4a25-8fc4-29689b39c3f7@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714406025; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NsRBY74Bfg5heYt2w1gPVTY1zYEHG1o7HaSNvAT0veY=; b=la50SNExVrvfi1d39DoSe/ovc3ZWfeh2yzBpLe97/jNasfxZL06OiPIObS5/vmQmymQC/U i03mLwyJjyiB46SxI6uSag+80FGyv1z9bzQaW+WRYcFgy+K++1AkLb2Xi8j4jduU92YIlW iCLzZN28IhHivqB6wTIIi1mUAsOmiA0= Date: Mon, 29 Apr 2024 08:53:36 -0700 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH bpf-next 1/2] selftests/bpf: Free strdup memory in test_sockmap To: Geliang Tang , Andrii Nakryiko , Eduard Zingerman , Mykola Lysenko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , Jakub Sitnicki Cc: Geliang Tang , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org References: Content-Language: en-GB X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Yonghong Song In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 4/29/24 12:07 AM, Geliang Tang wrote: > From: Geliang Tang > > The strdup() function returns a pointer to a new string which is a > duplicate of the string "ptr". Memory for the new string is obtained > with malloc(), and need to be freed with free(). > > This patch adds these missing "free(ptr)" in check_whitelist() and > check_blacklist() to avoid memory leaks in test_sockmap.c. > > Signed-off-by: Geliang Tang Acked-by: Yonghong Song