diff options
Diffstat (limited to 'mono/DBusType/String.cs')
-rw-r--r-- | mono/DBusType/String.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mono/DBusType/String.cs b/mono/DBusType/String.cs index bf354ea0..3b619cfb 100644 --- a/mono/DBusType/String.cs +++ b/mono/DBusType/String.cs @@ -36,7 +36,10 @@ namespace DBus.DBusType { IntPtr marshalVal = Marshal.StringToHGlobalAnsi (val); - if (!dbus_message_iter_append_basic (iter, (int) Code, ref marshalVal)) + bool success = dbus_message_iter_append_basic (iter, (int) Code, ref marshalVal); + Marshal.FreeHGlobal (marshalVal); + + if (!success) throw new ApplicationException("Failed to append STRING argument:" + val); } |