[dpdk-dev] [PATCH v1 2/2] crypto/aesni_mb: improve security instance setup

Coyle, David david.coyle at intel.com
Mon Jul 20 14:38:42 CEST 2020


Hi Pablo

> -----Original Message-----
> From: De Lara Guarch, Pablo <pablo.de.lara.guarch at intel.com>
> Sent: Friday, July 17, 2020 8:29 PM
> >
> >  #ifdef AESNI_MB_DOCSIS_SEC_ENABLED
> > +	struct rte_security_ctx *security_instance;
> >  	security_instance = rte_malloc("aesni_mb_sec",
> >  				sizeof(struct rte_security_ctx),
> >  				RTE_CACHE_LINE_SIZE);
> 
> I see that there could be a potential memory leak here.
> Assuming this malloc works, if alloc_init_mb_mgr() fails, this memory will not
> be freed.
> So I suggest two options:
> 1 - Free security_instance if alloc_init_mb_mgr() fails
> 2 - Move this piece of code after alloc_init_mb_mgr and free mb_mgr if this
> malloc fails.

[DC] Good catch, disappointed I didn't spot that myself :(
This is fixed in v2 coming very shortly - used option 1 above
> 



More information about the dev mailing list