From 6a365c0811b2fafa602d6c219ddbe341e8aa16d6 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Mon, 18 Feb 2019 15:40:26 +0100 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/c/445149 (master) Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447580 Reviewed-by: Ben Walker Tested-by: SPDK CI Jenkins --- lib/env_dpdk/init.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/env_dpdk/init.c b/lib/env_dpdk/init.c index cc2aa87a5..eba9b29eb 100644 --- a/lib/env_dpdk/init.c +++ b/lib/env_dpdk/init.c @@ -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; }