aboutsummaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-06-29 08:36:02 +0200
committerKevin Wolf <kwolf@redhat.com>2021-07-09 12:26:05 +0200
commitc2615bdfbd6d5a1a48438102f8ab328fe30b8e27 (patch)
tree39b064cf8a99123401486c8652591e144e85160e /util
parenteb06cbab7e92caf15033c91dfcacd2ba5d7bc88a (diff)
downloadqemu-c2615bdfbd6d5a1a48438102f8ab328fe30b8e27.zip
qemu-c2615bdfbd6d5a1a48438102f8ab328fe30b8e27.tar.gz
qemu-c2615bdfbd6d5a1a48438102f8ab328fe30b8e27.tar.bz2
util/uri: do not check argument of uri_free()
uri_free() checks if its argument is NULL in uri_clean() and g_free(). There is no need to check the argument before the call. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Message-Id: <20210629063602.4239-1-xypron.glpk@gmx.de> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'util')
-rw-r--r--util/uri.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/util/uri.c b/util/uri.c
index 8bdef84..ff72c60 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -1340,7 +1340,7 @@ static void uri_clean(URI *uri)
/**
* uri_free:
- * @uri: pointer to an URI
+ * @uri: pointer to an URI, NULL is ignored
*
* Free up the URI struct
*/
@@ -1939,15 +1939,9 @@ step_7:
val = uri_to_string(res);
done:
- if (ref != NULL) {
- uri_free(ref);
- }
- if (bas != NULL) {
- uri_free(bas);
- }
- if (res != NULL) {
- uri_free(res);
- }
+ uri_free(ref);
+ uri_free(bas);
+ uri_free(res);
return val;
}
@@ -2190,12 +2184,8 @@ done:
if (remove_path != 0) {
ref->path = NULL;
}
- if (ref != NULL) {
- uri_free(ref);
- }
- if (bas != NULL) {
- uri_free(bas);
- }
+ uri_free(ref);
+ uri_free(bas);
return val;
}