From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18946 invoked by alias); 5 Aug 2007 03:29:11 -0000 Received: (qmail 18847 invoked by uid 22791); 5 Aug 2007 03:29:10 -0000 X-Spam-Check-By: sourceware.org Received: from a.mail.sonic.net (HELO a.mail.sonic.net) (64.142.16.245) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 05 Aug 2007 03:29:08 +0000 Received: from webmail.sonic.net (b.webmail.sonic.net [64.142.100.148]) by a.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id l753T6TX030546 for ; Sat, 4 Aug 2007 20:29:06 -0700 Received: from 12.7.175.2 (SquirrelMail authenticated user msnyder) by webmail.sonic.net with HTTP; Sat, 4 Aug 2007 20:29:06 -0700 (PDT) Message-ID: <13153.12.7.175.2.1186284546.squirrel@webmail.sonic.net> Date: Sun, 05 Aug 2007 03:29:00 -0000 Subject: [patch] target_read_string, potential memory leak. From: msnyder@sonic.net To: gdb-patches@sourceware.org User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: multipart/mixed;boundary="----=_20070804202906_13845" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-08/txt/msg00098.txt.bz2 ------=_20070804202906_13845 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Content-length: 132 OK -- it would be pretty stupid to call target_read_string without passing it a buffer, but if we're going to check it for null... ------=_20070804202906_13845 Content-Type: text/plain; name="137.txt" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="137.txt" Content-length: 567 2007-08-04 Michael Snyder * target.c (target_read_string): Potential memory leak. Index: target.c =================================================================== RCS file: /cvs/src/src/gdb/target.c,v retrieving revision 1.145 diff -p -r1.145 target.c *** target.c 24 Jul 2007 12:49:24 -0000 1.145 --- target.c 5 Aug 2007 03:25:25 -0000 *************** done: *** 972,977 **** --- 972,980 ---- *errnop = errcode; if (string != NULL) *string = buffer; + else + xfree (buffer); + return nbytes_read; } ------=_20070804202906_13845--