* [Qemu-devel] [PATCH] block/curl: Fix wrong free statement
@ 2012-09-01 9:06 Stefan Weil
2012-09-04 14:11 ` Kevin Wolf
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2012-09-01 9:06 UTC (permalink / raw)
To: Kevin Wolf; +Cc: qemu-trivial, Stefan Weil, qemu-devel
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>
---
block/curl.c | 3 +--
1 file changed, 1 insertion(+), 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.10
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] block/curl: Fix wrong free statement
2012-09-01 9:06 [Qemu-devel] [PATCH] block/curl: Fix wrong free statement Stefan Weil
@ 2012-09-04 14:11 ` Kevin Wolf
0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2012-09-04 14:11 UTC (permalink / raw)
To: Stefan Weil; +Cc: qemu-trivial, qemu-devel
Am 01.09.2012 11:06, schrieb Stefan Weil:
> 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>
Thanks, applied to block-next.
Kevin
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-09-04 14:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-01 9:06 [Qemu-devel] [PATCH] block/curl: Fix wrong free statement Stefan Weil
2012-09-04 14:11 ` Kevin Wolf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.