From: Stefan Weil Date: Sat, 1 Sep 2012 09:06:45 +0000 (+0200) Subject: block/curl: Fix wrong free statement X-Git-Tag: v1.2.1~79 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1e32a1651aeb071481b20f873f8d61a0692f7be5;p=thirdparty%2Fqemu.git block/curl: Fix wrong free statement 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 Signed-off-by: Kevin Wolf (cherry picked from commit 45724d6d02383b0d7d4a90e05787fca7c55cb070) Signed-off-by: Michael Roth --- diff --git a/block/curl.c b/block/curl.c index e7c3634d354..c1074cd2e31 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)