> -----Original Message-----
> From: Singh, Jasvinder <jasvinder.si...@intel.com>
> Sent: Wednesday, July 14, 2021 7:08 PM
> To: Yu, DapengX <dapengx...@intel.com>; Dumitrescu, Cristian
> <cristian.dumitre...@intel.com>
> Cc: dev@dpdk.org; sta...@dpdk.org
> Subject: RE: [PATCH v3] net/softnic: fix memory leak in parsing arguments
> 
> <snip>
> 
> > +   free(firmware);
> 
> Memory for firmware is not allocated dynamically, so no need for this.

I have double checked it, at this code snippet, the memory block referenced by 
the "firmware" pointer is allocated by the strdup() in get_string() function.
The free(firmware) is necessary, and it prevents memory leak.
> 
> <snip>
> 
> >  struct pmd_params {
> > -   const char *name;
> > -   const char *firmware;
> > +   char name[RTE_DEV_NAME_MAX_LEN];
> 
> Please replace " RTE_DEV_NAME_MAX_LEN " with "NAME_SIZE" which is
> already defined in softnic_internals.h

It will be modified in the next version.
> 
> > +   char firmware[PATH_MAX];
> 
> Also, instead of using PATH_MAX, define new macro "SOFTNIC_PATH_MAX
> 4096" in softnic_internals.h

It will be modified in the next version.
> 
> 
> >     uint16_t conn_port;
> >     uint32_t cpu_id;
> >     int sc; /**< Service cores. */
> > --
> > 2.27.0

Reply via email to