summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2021-12-14 15:24:08 +0100
committerRalf Habacker <ralf.habacker@freenet.de>2021-12-16 09:46:46 +0100
commit1bbc135234731ce1b6ac65dd1c6907dbb01c8833 (patch)
tree8010f8cb509da21f8be28c3aa7a7bdb83f8176f2
parentd9e404c03a199744e1fd905fa7f4b4c13a1e8319 (diff)
downloaddbus-1bbc135234731ce1b6ac65dd1c6907dbb01c8833.tar.gz
Fix "out of memory" handling in _dbus_get_install_root_as_hash()
Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
-rw-r--r--dbus/dbus-sysdeps-win.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c
index 53c7380f..deb275a8 100644
--- a/dbus/dbus-sysdeps-win.c
+++ b/dbus/dbus-sysdeps-win.c
@@ -2945,20 +2945,26 @@ static dbus_bool_t
_dbus_get_install_root_as_hash (DBusString *out)
{
DBusString install_path;
+ dbus_bool_t retval = FALSE;
_dbus_assert (out != NULL);
- _dbus_string_init (&install_path);
+ if (!_dbus_string_init (&install_path))
+ return FALSE;
if (!_dbus_get_install_root (&install_path) ||
_dbus_string_get_length (&install_path) == 0)
- return FALSE;
+ goto out;
_dbus_string_tolower_ascii (&install_path, 0, _dbus_string_get_length (&install_path));
if (!_dbus_sha_compute (&install_path, out))
- return FALSE;
+ goto out;
- return TRUE;
+ retval = TRUE;
+
+out:
+ _dbus_string_free (&install_path);
+ return retval;
}
/**