main: Fix memory corruption

This commit is contained in:
Pali Rohár committed 2012-11-21 14:54:24 +01:00
1 parent 6665ba9917
commit ae03494a73
1 file changed
+5 -3
+5 -3
View File
@@ -389,6 +389,7 @@ int main(int argc, char **argv) {
int i; int i;
char buf[512]; char buf[512];
char * tmp = NULL;
simulate = 0; simulate = 0;
noverify = 0; noverify = 0;
@@ -1122,8 +1123,8 @@ int main(int argc, char **argv) {
if ( dev_dump_fiasco ) { if ( dev_dump_fiasco ) {
dev_dump = 1; dev_dump = 1;
dev_dump_arg = strdup(dev_dump_fiasco_arg); tmp = strdup(dev_dump_fiasco_arg);
dev_dump_arg = dirname(dev_dump_arg); dev_dump_arg = dirname(tmp);
} }
if ( dev_dump ) { if ( dev_dump ) {
@@ -1177,7 +1178,8 @@ int main(int argc, char **argv) {
fiasco_free(fiasco_out); /* this will also free list image_dump_first */ fiasco_free(fiasco_out); /* this will also free list image_dump_first */
} }
free(dev_dump_arg); free(tmp);
tmp = NULL;
dev_dump_arg = NULL; dev_dump_arg = NULL;
} }