From bf99381351b802fb3348a24037898222aae631e2 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Fri, 28 Mar 2003 05:42:19 +0000 Subject: 2003-03-28 Havoc Pennington * bus/test.c (bus_test_flush_bus): remove the sleep from here, I think it may have just been superstition. Not sure. * dbus/dbus-string.c (_dbus_string_base64_decode): catch some OOM failures that were not being handled. * dbus/dbus-auth.c (process_auth): fix a memleak in OOM handling * dbus/dbus-memory.c: add ability to set number of mallocs in a row that will fail on out-of-memory. * dbus/dbus-internals.c (_dbus_test_oom_handling): convenience function for testing out-of-memory handling. * bus/config-loader-expat.c (memsuite): don't wrap the dbus allocation functions, they do map exactly to the expat ones. --- dbus/dbus-string.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'dbus/dbus-string.c') diff --git a/dbus/dbus-string.c b/dbus/dbus-string.c index 1bc3e205..7549dcad 100644 --- a/dbus/dbus-string.c +++ b/dbus/dbus-string.c @@ -2108,15 +2108,22 @@ _dbus_string_base64_decode (const DBusString *source, */ if (pad_count < 1) - _dbus_string_append_byte (&result, - triplet >> 16); + { + if (!_dbus_string_append_byte (&result, + triplet >> 16)) + goto failed; + } if (pad_count < 2) - _dbus_string_append_byte (&result, - (triplet >> 8) & 0xff); + { + if (!_dbus_string_append_byte (&result, + (triplet >> 8) & 0xff)) + goto failed; + } - _dbus_string_append_byte (&result, - triplet & 0xff); + if (!_dbus_string_append_byte (&result, + triplet & 0xff)) + goto failed; sextet_count = 0; pad_count = 0; @@ -2136,6 +2143,11 @@ _dbus_string_base64_decode (const DBusString *source, _dbus_string_free (&result); return TRUE; + + failed: + _dbus_string_free (&result); + + return FALSE; } /** -- cgit