5544c1b
From a29b7f5390e33d089dcdbf75d6e92c20bbedc562 Mon Sep 17 00:00:00 2001
5544c1b
From: Stefan Weil <sw@weilnetz.de>
5544c1b
Date: Sat, 1 Sep 2012 11:06:45 +0200
5544c1b
Subject: [PATCH] block/curl: Fix wrong free statement
5544c1b
5544c1b
Report from smatch:
5544c1b
block/curl.c:546 curl_close(21) info: redundant null check on s->url calling free()
5544c1b
5544c1b
The check was redundant, and free was also wrong because the memory
5544c1b
was allocated using g_strdup.
5544c1b
5544c1b
Signed-off-by: Stefan Weil <sw@weilnetz.de>
5544c1b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
5544c1b
(cherry picked from commit 45724d6d02383b0d7d4a90e05787fca7c55cb070)
5544c1b
5544c1b
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1b
---
5544c1b
 block/curl.c | 3 +--
5544c1b
 1 file changed, 1 insertion(+), 2 deletions(-)
5544c1b
5544c1b
diff --git a/block/curl.c b/block/curl.c
5544c1b
index e7c3634..c1074cd 100644
5544c1b
--- a/block/curl.c
5544c1b
+++ b/block/curl.c
5544c1b
@@ -542,8 +542,7 @@ static void curl_close(BlockDriverState *bs)
5544c1b
     }
5544c1b
     if (s->multi)
5544c1b
         curl_multi_cleanup(s->multi);
5544c1b
-    if (s->url)
5544c1b
-        free(s->url);
5544c1b
+    g_free(s->url);
5544c1b
 }
5544c1b
 
5544c1b
 static int64_t curl_getlength(BlockDriverState *bs)