aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2017-06-06 14:52:31 +0100
committerNick Clifton <nickc@redhat.com>2017-06-06 14:52:31 +0100
commitd24b756188bd63a422671a73e31af718007264ca (patch)
tree6038ed2215bccd7d1b76ccd566817d559632d7ce /binutils
parent0ee3a6dbd06b88a4e02f3f46c3ec036fd951400b (diff)
downloadgdb-d24b756188bd63a422671a73e31af718007264ca.zip
gdb-d24b756188bd63a422671a73e31af718007264ca.tar.gz
gdb-d24b756188bd63a422671a73e31af718007264ca.tar.bz2
Fix memory leaks in the sysinfo program.
* sysinfo.y: Free memory allocated by token NAME.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog4
-rw-r--r--binutils/sysinfo.y15
2 files changed, 18 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 1ecb042..0766e67 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,7 @@
+2017-06-06 Simon Marchi <simon.marchi@ericsson.com>
+
+ * sysinfo.y: Free memory allocated by token NAME.
+
2017-05-30 Anton Kolesov <anton.kolesov@synopsys.com>
* doc/binutils.texi: Document new cpu=... disassembler options for ARC.
diff --git a/binutils/sysinfo.y b/binutils/sysinfo.y
index 62758de..1c8f1ff2 100644
--- a/binutils/sysinfo.y
+++ b/binutils/sysinfo.y
@@ -21,6 +21,7 @@
%{
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
static char writecode;
static char *it;
@@ -159,6 +160,8 @@ it:
case 'c':
printf("}\n");
}
+
+ free (it);
}
;
@@ -204,6 +207,8 @@ repeat_it_field: '(' REPEAT NAME
it_field_list ')'
{
+ free (repeat);
+
repeat = oldrepeat;
oldrepeat =0;
rdepth--;
@@ -230,6 +235,8 @@ cond_it_field: '(' COND NAME
printf("\tif (%s) {\n", $3);
break;
}
+
+ free ($3);
}
it_field_list ')'
@@ -348,6 +355,9 @@ char *ptr = pnames[rdepth];
else abort();
break;
}
+
+ free (desc);
+ free (id);
}
;
@@ -371,7 +381,7 @@ attr_size:
attr_id:
'(' NAME ')' { $$ = $2; }
- | { $$ = "dummy";}
+ | { $$ = strdup ("dummy");}
;
enums:
@@ -388,6 +398,9 @@ enum_list:
case 'c':
printf("if (ptr->%s%s == %s) { tabout(); printf(\"%s\\n\");}\n", name, names[rdepth],$4,$3);
}
+
+ free ($3);
+ free ($4);
}
;