[libvirt] [PATCH] conf: remove NULL check from virDomainQemuMonitorEventNew

Ján Tomko posted 1 patch 4 years, 6 months ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/c299a749c8d24c15dd5587d6db5f823e3966936d.1571752785.git.jtomko@redhat.com
There is a newer version of this series
src/conf/domain_event.c | 8 --------
1 file changed, 8 deletions(-)
[libvirt] [PATCH] conf: remove NULL check from virDomainQemuMonitorEventNew
Posted by Ján Tomko 4 years, 6 months ago
The qemu_domain_monitor_event_msg struct in qemu_protocol.x
defines event as a nonnull_string and qemuMonitorJSONIOProcessEvent
also errors out on a non-NULL event.

Drop the check to fix the build with static analysis.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/conf/domain_event.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 644f6eb595..33fbf10406 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -1934,20 +1934,12 @@ virDomainQemuMonitorEventNew(int id,
                                  0, id, name, uuid, uuidstr)))
         return NULL;
 
-    /* event is mandatory, details are optional */
-    if (!event)
-        goto error;
-
     ev->event = g_strdup(event);
     ev->seconds = seconds;
     ev->micros = micros;
     ev->details = g_strdup(details);
 
     return (virObjectEventPtr)ev;
-
- error:
-    virObjectUnref(ev);
-    return NULL;
 }
 
 
-- 
2.19.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] conf: remove NULL check from virDomainQemuMonitorEventNew
Posted by Erik Skultety 4 years, 6 months ago
On Tue, Oct 22, 2019 at 03:59:53PM +0200, Ján Tomko wrote:
> The qemu_domain_monitor_event_msg struct in qemu_protocol.x
> defines event as a nonnull_string and qemuMonitorJSONIOProcessEvent
> also errors out on a non-NULL event.
>
> Drop the check to fix the build with static analysis.
>
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
Reviewed-by: Erik Skultety <eskultet@redhat.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list