]> xenbits.xensource.com Git - libvirt.git/commitdiff
remote_daemon_dispatch: Don't open code xdr_free()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 27 Aug 2019 09:49:27 +0000 (11:49 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 28 Aug 2019 09:19:43 +0000 (11:19 +0200)
At two places we are open coding xdr_free():
remoteRelayDomainEventTunable() and
remoteRelayDomainEventJobCompleted().
Bot of these functions use make_nonnull_domain() to put domain
IDs tuple into return structure and then continue encoding the
rest of structure. If that fails, they call VIR_FREE() directly.
While this okay, we should use xdr_free() which frees the whole
return structure for us.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
src/remote/remote_daemon_dispatch.c

index c658a6e115d56e9f2d97a2e98d60a6ac65954207..ecde959088a3c99d8b5ffef19915d2043d39cdda 100644 (file)
@@ -1156,8 +1156,7 @@ remoteRelayDomainEventTunable(virConnectPtr conn,
                                 (virTypedParameterRemotePtr *) &data.params.params_val,
                                 &data.params.params_len,
                                 VIR_TYPED_PARAM_STRING_OKAY) < 0) {
-        VIR_FREE(data.dom.name);
-        return -1;
+        goto error;
     }
 
     remoteDispatchObjectEventSend(callback->client, remoteProgram,
@@ -1323,8 +1322,7 @@ remoteRelayDomainEventJobCompleted(virConnectPtr conn,
                                 (virTypedParameterRemotePtr *) &data.params.params_val,
                                 &data.params.params_len,
                                 VIR_TYPED_PARAM_STRING_OKAY) < 0) {
-        VIR_FREE(data.dom.name);
-        return -1;
+        goto error;
     }
 
     remoteDispatchObjectEventSend(callback->client, remoteProgram,