From 7b63fe3cfa4e8c289bde0dbcfdaa95d692c39cdb Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 21 Jun 2011 14:09:52 +0100 Subject: [PATCH] In Windows _dbus_printf_string_upper_bound, don't crash on malloc failure --- dbus/dbus-sysdeps-win.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index 7b03c3dd..f9afadad 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -549,6 +549,10 @@ int _dbus_printf_string_upper_bound (const char *format, bufsize *= 2; p = malloc (bufsize); + + if (p == NULL) + return -1; + len = _vsnprintf (p, bufsize - 1, format, args); free (p); }