Commit id '0fe4aa149' added @origErr, but since it's assigned outside
the if condition, the free should be outside as well.

Found by Coverity

Signed-off-by: John Ferlan <jfer...@redhat.com>
---
 daemon/stream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/daemon/stream.c b/daemon/stream.c
index 5077ac8..49682f1 100644
--- a/daemon/stream.c
+++ b/daemon/stream.c
@@ -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) {
-- 
2.9.4

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

Reply via email to