]> xenbits.xensource.com Git - libvirt.git/commitdiff
daemon: Don't conditionally free @origErr in daemonStreamEvent
authorJohn Ferlan <jferlan@redhat.com>
Thu, 20 Jul 2017 10:44:21 +0000 (06:44 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 20 Jul 2017 14:08:27 +0000 (10:08 -0400)
Commit id '0fe4aa149' added @origErr, but since it's assigned outside
the if condition, the free should be outside as well.

Found by Coverity

daemon/stream.c

index 5077ac8b0af541c40bf8a36f2503a11fd70c1ce0..49682f11457495178f02456ad353bee271b689b7 100644 (file)
@@ -239,7 +239,6 @@ daemonStreamEvent(virStreamPtr st, int events, void *opaque)
         virStreamAbort(stream->st);
         if (origErr && origErr->code != VIR_ERR_OK) {
             virSetError(origErr);
-            virFreeError(origErr);
         } else {
             if (events & VIR_STREAM_EVENT_HANGUP)
                 virReportError(VIR_ERR_RPC,
@@ -248,6 +247,7 @@ daemonStreamEvent(virStreamPtr st, int events, void *opaque)
                 virReportError(VIR_ERR_RPC,
                                "%s", _("stream had I/O failure"));
         }
+        virFreeError(origErr);
 
         msg = virNetMessageNew(false);
         if (!msg) {