From patchwork Sat Jan 8 18:24:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 77974 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5E8DDB7063 for ; Sun, 9 Jan 2011 05:30:18 +1100 (EST) Received: from localhost ([127.0.0.1]:55945 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PbdYN-0000n1-Mz for incoming@patchwork.ozlabs.org; Sat, 08 Jan 2011 13:30:15 -0500 Received: from [140.186.70.92] (port=48070 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PbdTQ-0006Vo-4u for qemu-devel@nongnu.org; Sat, 08 Jan 2011 13:25:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PbdTO-0006yE-UA for qemu-devel@nongnu.org; Sat, 08 Jan 2011 13:25:07 -0500 Received: from mail-pv0-f173.google.com ([74.125.83.173]:44472) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PbdTO-0006w9-Mn for qemu-devel@nongnu.org; Sat, 08 Jan 2011 13:25:06 -0500 Received: by mail-pv0-f173.google.com with SMTP id 11so4258015pvh.4 for ; Sat, 08 Jan 2011 10:25:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=Bk7pQRCqeWgRj2c4EERzXg0p7k06VIabODMUqzevcuE=; b=bCRz1UsLcS3AxSKQocDhgKB+dLoBbiSGPmEjWc8f7+0j4knsau38lYTFEJa7ul+3TG NYItoPWeBTVIPc9E39S85JJHs7PIHPUGVWs6mSoCj2hmYDzV6n2KFa38u6x6Xjv1NMmR oYTZOJJAUpNSih+SMm6mKZQyV3zIA6iYq1kxg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=naKSEbSk+UtXU9hVr0B3CElJd4Cmo4lffSz5W8hxaP9qE1Sr3nDXHPuZJsVUGSOmiH LGtFsWl360oCae8LRsyMXw7yTFQswR3hLHXaxsELZoCOOoAhmyUZRDZEBEmuPLPFKu2U 1R5VISET5R87RdYJPLhxrh6sK1pi/z6s91SCM= Received: by 10.143.43.12 with SMTP id v12mr2773197wfj.344.1294511106368; Sat, 08 Jan 2011 10:25:06 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.241.1 with HTTP; Sat, 8 Jan 2011 10:24:46 -0800 (PST) From: Blue Swirl Date: Sat, 8 Jan 2011 18:24:46 +0000 Message-ID: To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: [Qemu-devel] [PATCH 4/7] qemu-io: fix a memory leak X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Fix a memory leak, reported by cppcheck: [/src/qemu/qemu-io.c:1135]: (error) Memory leak: ctx Signed-off-by: Blue Swirl --- qemu-io.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/qemu-io.c b/qemu-io.c index 65dee13..5b24c5e 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -1131,8 +1131,10 @@ aio_read_f(int argc, char **argv) case 'P': ctx->Pflag = 1; ctx->pattern = parse_pattern(optarg); - if (ctx->pattern < 0) + if (ctx->pattern < 0) { + free(ctx); return 0; + } break; case 'q': ctx->qflag = 1;