diff options
author | Joel Sherrill <joel.sherrill@oarcorp.com> | 2014-11-27 09:28:42 -0600 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@oarcorp.com> | 2014-11-27 09:28:42 -0600 |
commit | a8b071dbd5d142b924861cf5508e84a828302fb4 (patch) | |
tree | be4d67c8022e745a94507fc7a0cab9f6bf95dd17 /tools | |
parent | bsp/qoriq: Delete empty header file (diff) | |
download | rtems-a8b071dbd5d142b924861cf5508e84a828302fb4.tar.bz2 |
rtems-bin2c.c: Fix free() of altered pointer
Diffstat (limited to 'tools')
-rw-r--r-- | tools/build/rtems-bin2c.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/build/rtems-bin2c.c b/tools/build/rtems-bin2c.c index fc0381a259..391c25901f 100644 --- a/tools/build/rtems-bin2c.c +++ b/tools/build/rtems-bin2c.c @@ -119,8 +119,8 @@ void process(const char *ifname, const char *ofname) } /* find basename */ - char *ifbasename = strdup(ifname); - if ( ifbasename == NULL ) { + char *ifbasename_to_free = strdup(ifname); + if ( ifbasename_to_free == NULL ) { fprintf(stderr, "cannot allocate memory\n" ); fclose(ifile); if ( createC ) { fclose(ocfile); } @@ -128,7 +128,8 @@ void process(const char *ifname, const char *ofname) exit(1); } - ifbasename = basename(ifbasename); + char *ifbasename; + ifbasename = basename(ifbasename_to_free); strcpy(buf, ifbasename); for (p = buf; *p != '\0'; ++p) { @@ -252,7 +253,7 @@ void process(const char *ifname, const char *ofname) fclose(ifile); if ( createC ) { fclose(ocfile); } if ( createH ) { fclose(ohfile); } - free(ifbasename); + free(ifbasename_to_free); } void usage(void) |