diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-11-10 14:56:51 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2019-11-10 15:30:04 +0100 |
commit | c890094638880072cfa95a06cb1353f0214a11a0 (patch) | |
tree | 912fb193d5786547749a8c05591cf987d2345045 /nand-utils/nanddump.c | |
parent | af06f37bdee2097d23832da99a3e7725de2f695e (diff) |
nanddump: don't leak copied command line arguments
For some command line flags, the argument string is copied. Simply
writing over the buffer leads to a resource leak if the same flag
is specified on the command line more than once.
This patch adds a free() call to the old buffer before overwriting
it with the new copy.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'nand-utils/nanddump.c')
-rw-r--r-- | nand-utils/nanddump.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/nand-utils/nanddump.c b/nand-utils/nanddump.c index 2f167bb..841ed67 100644 --- a/nand-utils/nanddump.c +++ b/nand-utils/nanddump.c @@ -162,6 +162,7 @@ static void process_options(int argc, char * const argv[]) start_addr = simple_strtoll(optarg, &error); break; case 'f': + free(dumpfile); dumpfile = xstrdup(optarg); break; case 'l': |