]> xenbits.xensource.com Git - libvirt.git/commitdiff
remote: Replace VIR_ALLOC_N with g_new0 in remoteRelayDomainEventGraphics
authorPeter Krempa <pkrempa@redhat.com>
Tue, 22 Oct 2019 14:08:07 +0000 (16:08 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 24 Oct 2019 17:35:34 +0000 (19:35 +0200)
Allocate the array of graphics identity objects using g_new0 to allow
dropping the 'error' label.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
ACKed-by: Eric Blake <eblake@redhat.com>
src/remote/remote_daemon_dispatch.c

index f292f8b8e6beb120025b429c3ab000e6a6e8244f..1ea952881727be73029d18d7a64e49dc45227c86 100644 (file)
@@ -596,8 +596,8 @@ remoteRelayDomainEventGraphics(virConnectPtr conn,
     data.remote.service = g_strdup(remote->service);
 
     data.subject.subject_len = subject->nidentity;
-    if (VIR_ALLOC_N(data.subject.subject_val, data.subject.subject_len) < 0)
-        goto error;
+    data.subject.subject_val = g_new0(remote_domain_event_graphics_identity,
+                                      data.subject.subject_len);
 
     for (i = 0; i < data.subject.subject_len; i++) {
         data.subject.subject_val[i].type = g_strdup(subject->identities[i].type);
@@ -619,11 +619,6 @@ remoteRelayDomainEventGraphics(virConnectPtr conn,
     }
 
     return 0;
-
- error:
-    xdr_free((xdrproc_t)xdr_remote_domain_event_lifecycle_msg,
-             (char *) &data);
-    return -1;
 }
 
 static int