On Mon, Apr 14, 2014 at 01:41:18PM +0200, Martin Kletzander wrote:
Adding dbus_message_unref() into virDBusMessageDecodeArgs() makes
sure
that the message gets unref'd, thus making one more pure dbus call not
necessary. Even though we are calling a lot of dbus_* functions
outside virdbus (which should be fixed in the future IMHO), this patch
fixes only this one instance because it merely aims to fix a
build-breaker caused by improperly included dbus.h. The message
printed when failing (using --without-dbus) is:
diff --git a/src/util/virdbus.c b/src/util/virdbus.c
index 0cd3858..aef1d34 100644
--- a/src/util/virdbus.c
+++ b/src/util/virdbus.c
@@ -1112,6 +1112,7 @@ int virDBusMessageDecodeArgs(DBusMessage* msg,
}
ret = virDBusMessageIterDecode(&iter, types, args);
+ dbus_message_unref(msg);
cleanup:
return ret;
NACK, this is basically reverting the change I did previously and
will break the firewall patches I have pending.
commit dc7f3ffc023e3decf6aca3a2cfba2d884f0413a4
Author: Daniel P. Berrange <berrange(a)redhat.com>
Date: Wed Mar 19 10:55:13 2014 +0000
Remove bogus unref in virDBusMessageRead
The virDBusMessageRead method should not have side-effects on
the message parameter passed in, so unref'ing it is wrong.
The caller should unref only when they decided they are done
with it.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
diff --git a/src/util/virdbus.c b/src/util/virdbus.c
index ecfe9f6..cbaf995 100644
--- a/src/util/virdbus.c
+++ b/src/util/virdbus.c
@@ -1421,7 +1421,6 @@ int virDBusMessageRead(DBusMessage *msg,
ret = virDBusMessageDecodeArgs(msg, types, args);
va_end(args);
- dbus_message_unref(msg);
return ret;
}
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|