env/dpdk: fix potential memleak on init failure
When we were trying to push a newly allocated string into the arg array and the array realloc() failed, the string we were about to insert was leaked. Change-Id: I31ccd5a09956d5407b2938792ecc9b482b2419d1 Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/445149 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
df99e28158
commit
9858408b55
@ -162,6 +162,7 @@ spdk_push_arg(char *args[], int *argcount, char *arg)
|
||||
|
||||
tmp = realloc(args, sizeof(char *) * (*argcount + 1));
|
||||
if (tmp == NULL) {
|
||||
free(arg);
|
||||
spdk_free_args(args, *argcount);
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user