In Windows _dbus_printf_string_upper_bound, don't crash on malloc failure
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 21 Jun 2011 13:09:52 +0000 (14:09 +0100)
committerRalf Habacker <ralf.habacker@freenet.de>
Sun, 3 Jul 2011 04:36:07 +0000 (06:36 +0200)
dbus/dbus-sysdeps-win.c

index 7b03c3d..f9afada 100644 (file)
@@ -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);
     }