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 (master)
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447580
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Darek Stojaczyk 2019-02-18 15:40:26 +01:00
parent cad2095077
commit 6a365c0811

View File

@ -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;
}