Commit 9858408b authored by Darek Stojaczyk's avatar Darek Stojaczyk
Browse files

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: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/445149


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent df99e281
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
	}