[dpdk-dev] [PATCH v2 1/5] devargs: fix memory leak on parsing error

Thomas Monjalon thomas at monjalon.net
Thu Mar 18 10:12:40 CET 2021


18/01/2021 16:16, Xueming Li:
> --- a/lib/librte_eal/common/eal_common_devargs.c
> +++ b/lib/librte_eal/common/eal_common_devargs.c
> +	if (ret != 0) {
> +		if (devargs->data && devargs->data != devstr) {

Better to make comparison explicit:
	if (devargs->data != NULL

> +			/* Free duplicated data. */
> +			free(devargs->data);

Before patch 2, devargs->data is const,
so we cannot free (compilation error).





More information about the dev mailing list