cfgfile: fix leak on creation error
authorJacek Piasecki <jacekx.piasecki@intel.com>
Thu, 26 Oct 2017 06:21:09 +0000 (08:21 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 7 Nov 2017 01:18:42 +0000 (02:18 +0100)
commitd04fc01de2298e2b7e405f499a919d1bd4d551f1
treeaecc50f304547861c5b503c03d1cd82373fc5e19
parent74e0d3a17461fadda1987baab775f7068e3732b1
cfgfile: fix leak on creation error

Unsuccesfull memory allocation for elements inside cfgfile
structure could result in resource leak.
Fixed by pointer verification after each malloc,
if malloc fail - error branch is proceeded with freeing memory.

Coverity issue: 195032
Fixes: d4cb8197589d ("cfgfile: support runtime modification")

Signed-off-by: Jacek Piasecki <jacekx.piasecki@intel.com>
Acked-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
lib/librte_cfgfile/rte_cfgfile.c