[v4,1/3] eal: fix memory leak when removing event_cb
diff mbox series

Message ID aa1c5c1da8151295c3df0402dab6901b9fbe0bc9.1593768308.git.wangyunjian@huawei.com
State New
Delegated to: David Marchand
Headers show
Series
  • fixes for device event
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

wangyunjian July 3, 2020, 9:46 a.m. UTC
From: Yunjian Wang <wangyunjian@huawei.com>

The event_cb->dev_name is not freed when freeing event_cb,
and this causes a memory leak.

Fixes: a753e53d517b ("eal: add device event monitor framework")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 lib/librte_eal/common/eal_common_dev.c | 1 +
 1 file changed, 1 insertion(+)

Comments

wangyunjian July 29, 2020, 11:47 a.m. UTC | #1
Ping for review.

Thanks,
Yunjian

> -----Original Message-----
> From: wangyunjian
> Sent: Friday, July 3, 2020 5:46 PM
> To: dev@dpdk.org
> Cc: jia.guo@intel.com; Lilijun (Jerry) <jerry.lilijun@huawei.com>; xudingke
> <xudingke@huawei.com>; wangyunjian <wangyunjian@huawei.com>;
> stable@dpdk.org
> Subject: [dpdk-dev] [PATCH v4 1/3] eal: fix memory leak when removing
> event_cb
> 
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> The event_cb->dev_name is not freed when freeing event_cb, and this causes a
> memory leak.
> 
> Fixes: a753e53d517b ("eal: add device event monitor framework")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>  lib/librte_eal/common/eal_common_dev.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/librte_eal/common/eal_common_dev.c
> b/lib/librte_eal/common/eal_common_dev.c
> index 9e4f09d..363a2ca 100644
> --- a/lib/librte_eal/common/eal_common_dev.c
> +++ b/lib/librte_eal/common/eal_common_dev.c
> @@ -526,6 +526,7 @@ static int cmp_dev_name(const struct rte_device *dev,
> const void *_name)
>  		 */
>  		if (event_cb->active == 0) {
>  			TAILQ_REMOVE(&dev_event_cbs, event_cb, next);
> +			free(event_cb->dev_name);
>  			free(event_cb);
>  			ret++;
>  		} else {
> --
> 1.8.3.1
>
Jeff Guo July 30, 2020, 2:57 a.m. UTC | #2
hi, yunjian

The patch seems no problem, but when you update your patch, please add 
other guys who had comment on your patch and maintainer to see if they have

other opinion, and --in-reply-to is also helpful for patch review, thanks.

On 7/29/2020 7:47 PM, wangyunjian wrote:
> Ping for review.
>
> Thanks,
> Yunjian
>
>> -----Original Message-----
>> From: wangyunjian
>> Sent: Friday, July 3, 2020 5:46 PM
>> To: dev@dpdk.org
>> Cc: jia.guo@intel.com; Lilijun (Jerry) <jerry.lilijun@huawei.com>; xudingke
>> <xudingke@huawei.com>; wangyunjian <wangyunjian@huawei.com>;
>> stable@dpdk.org
>> Subject: [dpdk-dev] [PATCH v4 1/3] eal: fix memory leak when removing
>> event_cb
>>
>> From: Yunjian Wang <wangyunjian@huawei.com>
>>
>> The event_cb->dev_name is not freed when freeing event_cb, and this causes a
>> memory leak.
>>
>> Fixes: a753e53d517b ("eal: add device event monitor framework")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
>> ---
>>   lib/librte_eal/common/eal_common_dev.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/lib/librte_eal/common/eal_common_dev.c
>> b/lib/librte_eal/common/eal_common_dev.c
>> index 9e4f09d..363a2ca 100644
>> --- a/lib/librte_eal/common/eal_common_dev.c
>> +++ b/lib/librte_eal/common/eal_common_dev.c
>> @@ -526,6 +526,7 @@ static int cmp_dev_name(const struct rte_device *dev,
>> const void *_name)
>>   		 */
>>   		if (event_cb->active == 0) {
>>   			TAILQ_REMOVE(&dev_event_cbs, event_cb, next);
>> +			free(event_cb->dev_name);
>>   			free(event_cb);
>>   			ret++;
>>   		} else {
>> --
>> 1.8.3.1


Acked-by: Jeff Guo <jia.guo@intel.com>

Patch
diff mbox series

diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 9e4f09d..363a2ca 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -526,6 +526,7 @@  static int cmp_dev_name(const struct rte_device *dev, const void *_name)
 		 */
 		if (event_cb->active == 0) {
 			TAILQ_REMOVE(&dev_event_cbs, event_cb, next);
+			free(event_cb->dev_name);
 			free(event_cb);
 			ret++;
 		} else {