Ecore_X: If malloc fails (when trying to get a window property list),
authorChristopher Michael <cpmichael1@comcast.net>
Fri, 11 Nov 2011 19:11:35 +0000 (19:11 +0000)
committerChristopher Michael <cpmichael1@comcast.net>
Fri, 11 Nov 2011 19:11:35 +0000 (19:11 +0000)
then return -1 to indicate failure. Add some missing parens in the
formatting.

SVN revision: 65074

legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c

index b838299..8d5c757 100644 (file)
@@ -118,13 +118,18 @@ ecore_x_window_prop_card32_list_get(Ecore_X_Window win,
                           &bytes_after, &prop_ret) != Success)
      return -1;
 
-   if (type_ret != XA_CARDINAL || format_ret != 32)
+   if ((type_ret != XA_CARDINAL) || (format_ret != 32))
      num = -1;
-   else if (num_ret == 0 || !prop_ret)
+   else if ((num_ret == 0) || (!prop_ret))
      num = 0;
    else
      {
         val = malloc(num_ret * sizeof(unsigned int));
+        if (!val) 
+          {
+             if (prop_ret) XFree(prop_ret);
+             return -1;
+          }
         for (i = 0; i < num_ret; i++)
           val[i] = ((unsigned long *)prop_ret)[i];
         num = num_ret;