qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: anthony@codemonkey.ws
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 04/11] block/curl: Fix wrong free statement
Date: Fri, 14 Sep 2012 14:39:05 +0200	[thread overview]
Message-ID: <1347626352-6023-5-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1347626352-6023-1-git-send-email-kwolf@redhat.com>

From: Stefan Weil <sw@weilnetz.de>

Report from smatch:
block/curl.c:546 curl_close(21) info: redundant null check on s->url calling free()

The check was redundant, and free was also wrong because the memory
was allocated using g_strdup.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/curl.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/block/curl.c b/block/curl.c
index e7c3634..c1074cd 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -542,8 +542,7 @@ static void curl_close(BlockDriverState *bs)
     }
     if (s->multi)
         curl_multi_cleanup(s->multi);
-    if (s->url)
-        free(s->url);
+    g_free(s->url);
 }
 
 static int64_t curl_getlength(BlockDriverState *bs)
-- 
1.7.6.5

  parent reply	other threads:[~2012-09-14 12:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14 12:39 [Qemu-devel] [PULL 00/11] Block patches Kevin Wolf
2012-09-14 12:39 ` [Qemu-devel] [PATCH 01/11] sheepdog: fix savevm and loadvm Kevin Wolf
2012-09-14 12:39 ` [Qemu-devel] [PATCH 02/11] ATAPI: STARTSTOPUNIT only eject/load media if powercondition is 0 Kevin Wolf
2012-09-14 12:39 ` [Qemu-devel] [PATCH 03/11] ide: Fix error messages from static code analysis (no real error) Kevin Wolf
2012-09-14 12:39 ` Kevin Wolf [this message]
2012-09-14 12:39 ` [Qemu-devel] [PATCH 05/11] vdi: Fix warning from clang Kevin Wolf
2012-09-14 12:39 ` [Qemu-devel] [PATCH 06/11] block: fix block tray status Kevin Wolf
2012-09-14 12:39 ` [Qemu-devel] [PATCH 07/11] ahci: properly reset PxCMD on HBA reset Kevin Wolf
2012-09-14 12:39 ` [Qemu-devel] [PATCH 08/11] qapi: Add SnapshotInfo and ImageInfo Kevin Wolf
2012-09-14 12:39 ` [Qemu-devel] [PATCH 09/11] qemu-img: Add json output option to the info command Kevin Wolf
2012-09-14 12:39 ` [Qemu-devel] [PATCH 10/11] Don't require encryption password for 'qemu-img info' command Kevin Wolf
2012-09-14 12:39 ` [Qemu-devel] [PATCH 11/11] block: Don't forget to delete temporary file Kevin Wolf
2012-09-17 18:19 ` [Qemu-devel] [PULL 00/11] Block patches Anthony Liguori
2012-09-18 17:49 ` Michael Tokarev
2012-09-19  8:42   ` Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1347626352-6023-5-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).