On Mon, Feb 24, 2020 at 12:38:03PM +0100, Damijan Skvarc wrote:
> OVS code provides useful functionality svec, which deals with dynamical
> vector of strings. This module already provides functionality for adding, 
> removing, modifying... strings in this vector. While working on reducing 
> memory
> leaks in OVN code I found ovs_cmdl_env_parse_all() function, which allocates
> array of strings with the help of svec. Resulting array represents memory
> leak (both in ovn-nctl and ovn-sctl) code, however since it is detached for 
> svec entity apparent functionality for releasing this memory could not be 
> used.
> 
> Instead of assigning allocated memory back to svec (with a purpose to 
> deallocate it
> with appropriate function) I was looking for yet another function in OVS 
> which would 
> do the same. Since I didn't find it I am proposing the following function. 
> I think the most apropriate location would be in util.c module, however if 
> someone
> could advice for some other possibility I would be thankful.
> 
> 
> 
> Signed-off-by: Damijan Skvarc <[email protected]>

Thanks for working on making OVS better.

The 'x' prefix usually means that a function aborts when a memory
allocation fails.  This function doesn't allocate memory, so I would
omit it.

I think I'd name this function something like free_strings().
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to