]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libcpu: Free unused new bitfield on error in i386_parse.y new_bitfield.
authorMark Wielaard <mark@klomp.org>
Sat, 9 May 2020 21:31:05 +0000 (23:31 +0200)
committerMark Wielaard <mark@klomp.org>
Thu, 14 May 2020 12:30:57 +0000 (14:30 +0200)
GCC10 -fanalyzer detected we didn't free the newly created bitfield
on error. Make sure to free it before returning.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libcpu/ChangeLog
libcpu/i386_parse.y

index a8b2b951e5104b2c166f21773012f94d905deec5..a342b7f646df8130316e678c914a9c2f32753468 100644 (file)
@@ -1,3 +1,7 @@
+2020-05-09  Mark Wielaard  <mark@klomp.org>
+
+       * i386_parse.y (new_bitfield): Call free newp on error.
+
 2020-04-16  Mark Wielaard  <mark@klomp.org>
 
        * i386_disasm.c (i386_disasm): Replace assert with goto invalid_op
index 910d5458148b6f7893b0232a995d6a112fdc3c47..90c7bd93449d9720573c06a5ab3c6da5151aabd1 100644 (file)
@@ -579,6 +579,7 @@ new_bitfield (char *name, unsigned long int num)
       error (0, 0, "%d: duplicated definition of bitfield '%s'",
             i386_lineno, name);
       free (name);
+      free (newp);
       return;
     }