From cd37dafcf4bc4c4dce9854529523aa1c3221f849 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 25 Mar 2011 17:22:15 +0000 Subject: [PATCH] * ieee.c (ieee_add_bb11): Plug memory leak. (ieee_function_type): Likewise. (ieee_class_baseclass): Likewise. --- binutils/ChangeLog | 3 +++ binutils/ieee.c | 22 +++++++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 99e5ed71fd..d6ee055d48 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -4,6 +4,9 @@ * ar.c (move_members): Plug memory leak. (delete_members): Plug memory leak. (write_archive): Plug memory leak. + * ieee.c (ieee_add_bb11): Plug memory leak. + (ieee_function_type): Likewise. + (ieee_class_baseclass): Likewise. 2011-03-25 Pierre Muller diff --git a/binutils/ieee.c b/binutils/ieee.c index c8460dc765..044da313dd 100644 --- a/binutils/ieee.c +++ b/binutils/ieee.c @@ -1,6 +1,6 @@ /* ieee.c -- Read and write IEEE-695 debugging information. Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, - 2008, 2009, 2010 Free Software Foundation, Inc. + 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GNU Binutils. @@ -5125,7 +5125,10 @@ ieee_add_bb11 (struct ieee_handle *info, asection *sec, bfd_vma low, || ! ieee_write_id (info, "") || ! ieee_write_number (info, 0) || ! ieee_write_id (info, "GNU objcopy")) - return FALSE; + { + free (c); + return FALSE; + } free (c); } @@ -5529,7 +5532,10 @@ ieee_function_type (void *p, int argcount, bfd_boolean varargs) || ! ieee_write_number (info, 0) || ! ieee_write_number (info, retindx) || ! ieee_write_number (info, (bfd_vma) argcount + (varargs ? 1 : 0))) - return FALSE; + { + free (args); + return FALSE; + } if (argcount > 0) { for (i = 0; i < argcount; i++) @@ -6235,7 +6241,10 @@ ieee_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean is_virtual, || ! ieee_write_id (info, fname) || ! ieee_write_number (info, bindx) || ! ieee_write_number (info, bitpos / 8)) - return FALSE; + { + free (fname); + return FALSE; + } flags = 0; } @@ -6250,7 +6259,10 @@ ieee_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean is_virtual, || ! ieee_write_atn65 (info, nindx, bname) || ! ieee_write_asn (info, nindx, 0) || ! ieee_write_atn65 (info, nindx, fname)) - return FALSE; + { + free (fname); + return FALSE; + } info->type_stack->type.classdef->pmisccount += 5; free (fname);