]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuMonitorJSONQueryFdsetsParse: Don't check value passed to g_strdup
authorPeter Krempa <pkrempa@redhat.com>
Tue, 11 Jan 2022 13:58:08 +0000 (14:58 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 14 Feb 2022 12:13:59 +0000 (13:13 +0100)
'g_strdup()' is NULL-tolerant.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_monitor_json.c

index 8e1501d91f3e4f5d6470740e58d7abcd2a6c86bd..69ecc8a2d191f00b61f631a6feccc64cf1b6e09f 100644 (file)
@@ -3695,7 +3695,6 @@ qemuMonitorJSONQueryFdsetsParse(virJSONValue *msg,
 
     for (i = 0; i < ninfo; i++) {
         size_t j;
-        const char *tmp;
         virJSONValue *fdarray;
         qemuMonitorFdsetInfo *fdsetinfo = &sets->fdsets[i];
 
@@ -3734,9 +3733,7 @@ qemuMonitorJSONQueryFdsetsParse(virJSONValue *msg,
             }
 
             /* opaque is optional and may be missing */
-            tmp = virJSONValueObjectGetString(fdentry, "opaque");
-            if (tmp)
-                fdinfo->opaque = g_strdup(tmp);
+            fdinfo->opaque = g_strdup(virJSONValueObjectGetString(fdentry, "opaque"));
         }
     }