qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-trivial] [PATCH 3/7] uri: avoid NULL arguments to strcmp


From: Paolo Bonzini
Subject: [Qemu-trivial] [PATCH 3/7] uri: avoid NULL arguments to strcmp
Date: Mon, 26 Jan 2015 12:12:23 +0100

Detected by Coverity.

Signed-off-by: Paolo Bonzini <address@hidden>
---
 util/uri.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/util/uri.c b/util/uri.c
index 918d235..014d40d 100644
--- a/util/uri.c
+++ b/util/uri.c
@@ -1971,7 +1971,9 @@ uri_resolve_relative (const char *uri, const char * base)
        val = g_strdup (uri);
        goto done;
     }
-    if (!strcmp(bas->path, ref->path)) {
+    if (bas->path == ref->path ||
+        (bas->path != NULL && ref->path != NULL &&
+         !strcmp(bas->path, ref->path))) {
        val = g_strdup("");
        goto done;
     }
-- 
1.8.3.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]