improve fix #72558, while (u>=0) with unsigned int will always be true
authorPierre Joye <pierre.php@gmail.com>
Tue, 19 Jul 2016 08:51:43 +0000 (15:51 +0700)
committerPierre Joye <pierre.php@gmail.com>
Tue, 19 Jul 2016 08:51:43 +0000 (15:51 +0700)
ext/gd/libgd/gd_interpolation.c

index 9481e3fd1dd4f8cd959ebbd79ccb95026dcb12ed..9a7789e365f798828dc1415ee0d0eab6f06df220 100644 (file)
@@ -904,11 +904,12 @@ static inline LineContribType * _gdContributionsAlloc(unsigned int line_length,
                        res->ContribRow[u].Weights = (double *) gdMalloc(windows_size * sizeof(double));
                }
                if (overflow_error == 1 || res->ContribRow[u].Weights == NULL) {
+                       unsigned int i;
                        u--;
-                       while (u >= 0) {
-                               gdFree(res->ContribRow[u].Weights);
-                               u--;
+                       for (i=0;i<=u;i++) {
+                               gdFree(res->ContribRow[i].Weights);
                        }
+                       gdFree(res);
                        return NULL;
                }
        }