[dpdk-dev] [PATCH v2] eal: fix resource leak

Thomas Monjalon thomas at monjalon.net
Fri Oct 6 00:33:23 CEST 2017

04/10/2017 21:24, Ferruh Yigit:
> On 9/22/2017 3:48 PM, Daniel Mrzyglod wrote:
> > Memory allocated in strdup is not free.
> > 
> > Coverity issue: 143257
> > Fixes: d8a2bc71dfc2 ("log: remove app path from syslog id")
> > Cc: thomas at monjalon.net
> > 
> > Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod at intel.com>
> > ---
> This works but this variable is a nuance and adding free() for this it
> into main eal features fail path looks like noise.
> Initially, do we need to strdup this variable at all?
> What will happen if logid fed into rte_eal_log_init() without strdup?
> Since it is const char *, I guess the string is just for read and
> content won't be changed so it should be OK I guess.
> If above is not right, what about creating a static variable and use it
> instead of dynamically allocating the logid, what do you think?

Good proposal Ferruh.
It seems strdup is not needed as it is basically argv[0].

More information about the dev mailing list