Skip to contentSkip to conversation

block/curl: Fix wrong free statement

PATCH Applied Stefan Weil 2 participants 2 messages Sep 1, 2012 – Sep 4, 2012 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 block/curl.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
block/curl.c +1 -2
index e7c3634..c1074cd 100644
@@ -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)
Signature · 1 line
1.7.10
Applied
#1 lore raw

Am 01.09.2012 11:06, schrieb Stefan Weil:

Quoted 7 lines

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.

Thanks, applied to block-next.

Kevin