From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14070 invoked by alias); 29 Jun 2007 04:32:06 -0000 Received: (qmail 14062 invoked by uid 22791); 29 Jun 2007 04:32:06 -0000 X-Spam-Check-By: sourceware.org Received: from b.mail.sonic.net (HELO b.mail.sonic.net) (64.142.19.5) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 29 Jun 2007 04:32:04 +0000 Received: from webmail.sonic.net (b.webmail.sonic.net [64.142.100.148]) by b.mail.sonic.net (8.13.8.Beta0-Sonic/8.13.7) with ESMTP id l5T4Vx20023517; Thu, 28 Jun 2007 21:31:59 -0700 Received: from 12.7.175.2 (SquirrelMail authenticated user msnyder) by webmail.sonic.net with HTTP; Thu, 28 Jun 2007 21:31:59 -0700 (PDT) Message-ID: <16794.12.7.175.2.1183091519.squirrel@webmail.sonic.net> In-Reply-To: <18052.32294.978000.582803@kahikatea.snap.net.nz> References: <24204.12.7.175.2.1183085800.squirrel@webmail.sonic.net> <18052.32294.978000.582803@kahikatea.snap.net.nz> Date: Fri, 29 Jun 2007 04:35:00 -0000 Subject: Re: [patch] memory leak, mi-cmd-var From: msnyder@sonic.net To: "Nick Roberts" Cc: msnyder@sonic.net, gdb-patches@sourceware.org User-Agent: SquirrelMail/1.4.9a MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit 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-06/txt/msg00521.txt.bz2 > 'nother one from Coverity. > > 2007-06-28 Michael Snyder > > * mi/mi-cmd-var.c (mi_cmd_var_set_format): Free strduped memory > (Coverity). Also take the opportunity to call error earlier > (before strdup). > I don't see why the string has to be duplicated in the first place or how > argv[1] could be NULL. Why not just: Well... you're right! At least about the strdup. About the NULL check -- it was already there, so I don't favor removing it unles we can demonstrate that it can't be NULL. But I'll re-submit after eliminating the strdup.