From 4ff6ab392a9986857a8532803b4e185374dd0708 Mon Sep 17 00:00:00 2001
From: Przemyslaw Marczak
Date: Fri, 28 Nov 2014 13:56:20 +0100
Subject: [PATCH] dfu: cmd: free memory allocated by strdup()
Change-Id: I69f49736af033314f9f4681eeb97fb11a0499b8b
Signed-off-by: Przemyslaw Marczak
---
common/cmd_dfu.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index b102b7d..40c3ccd 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -32,7 +32,8 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (!usb_controller || !interface || !devstring) {
puts("DFU: default device environment is not set.\n");
- return CMD_RET_USAGE;
+ ret = CMD_RET_USAGE;
+ goto bad_args;
}
break;
case 5:
@@ -94,6 +95,10 @@ done:
run_command("reset", 0);
dfu_clear_detach();
+bad_args:
+ free(usb_controller);
+ free(interface);
+ free(devstring);
return ret;
}
--
2.7.4