Change requested in launchpad bug #1288352
[packages/centos6/qemu.git] / 0163-block-curl-Fix-wrong-free-statement.patch
1 From a29b7f5390e33d089dcdbf75d6e92c20bbedc562 Mon Sep 17 00:00:00 2001
2 From: Stefan Weil <sw@weilnetz.de>
3 Date: Sat, 1 Sep 2012 11:06:45 +0200
4 Subject: [PATCH] block/curl: Fix wrong free statement
5
6 Report from smatch:
7 block/curl.c:546 curl_close(21) info: redundant null check on s->url calling free()
8
9 The check was redundant, and free was also wrong because the memory
10 was allocated using g_strdup.
11
12 Signed-off-by: Stefan Weil <sw@weilnetz.de>
13 Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 (cherry picked from commit 45724d6d02383b0d7d4a90e05787fca7c55cb070)
15
16 Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
17 ---
18  block/curl.c | 3 +--
19  1 file changed, 1 insertion(+), 2 deletions(-)
20
21 diff --git a/block/curl.c b/block/curl.c
22 index e7c3634..c1074cd 100644
23 --- a/block/curl.c
24 +++ b/block/curl.c
25 @@ -542,8 +542,7 @@ static void curl_close(BlockDriverState *bs)
26      }
27      if (s->multi)
28          curl_multi_cleanup(s->multi);
29 -    if (s->url)
30 -        free(s->url);
31 +    g_free(s->url);
32  }
33  
34  static int64_t curl_getlength(BlockDriverState *bs)
35 -- 
36 1.7.12.1
37