From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30046 invoked by alias); 9 Mar 2011 20:19:17 -0000 Received: (qmail 30036 invoked by uid 22791); 9 Mar 2011 20:19:15 -0000 X-SWARE-Spam-Status: No, hits=-5.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 Mar 2011 20:19:11 +0000 Received: from mailhost2.vmware.com (mailhost2.vmware.com [10.16.67.167]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id DCD5C1301F for ; Wed, 9 Mar 2011 12:19:09 -0800 (PST) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost2.vmware.com (Postfix) with ESMTP id D0A4A8EDCE for ; Wed, 9 Mar 2011 12:19:09 -0800 (PST) Message-ID: <4D77E0BD.2020307@vmware.com> Date: Wed, 09 Mar 2011 20:19:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.24 (X11/20101201) MIME-Version: 1.0 To: "binutils@sourceware.org" Subject: [RFA/gas] macro.c, close some memory leaks. Content-Type: multipart/mixed; boundary="------------050401070701010507030707" Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00189.txt.bz2 This is a multi-part message in MIME format. --------------050401070701010507030707 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 9 Review? --------------050401070701010507030707 Content-Type: text/plain; name="macro.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="macro.txt" Content-length: 885 2011-03-09 Michael Snyder * macro.c (get_any_string): Free malloced br_buf. (do_formals): Free 'formal'. Index: macro.c =================================================================== RCS file: /cvs/src/src/gas/macro.c,v retrieving revision 1.54 diff -u -p -r1.54 macro.c --- macro.c 18 Aug 2010 05:56:41 -0000 1.54 +++ macro.c 9 Mar 2011 20:14:43 -0000 @@ -407,7 +407,10 @@ get_any_string (int idx, sb *in, sb *out && in->ptr[idx] != tchar) sb_add_char (out, in->ptr[idx++]); if (idx == in->len) - return idx; + { + free (br_buf); + return idx; + } break; case '(': case '[': @@ -488,6 +491,7 @@ do_formals (macro_entry *macro, int idx, { if (macro->formal_count) --idx; + del_formal (formal); /* 'formal' goes out of scope. */ break; } idx = sb_skip_white (idx, in); --------------050401070701010507030707--