Changeset 780 for trunk/dll/dirsize.c


Ignore:
Timestamp:
Aug 12, 2007, 12:39:33 AM (18 years ago)
Author:
Gregg Young
Message:

Free memory on error for first xrealloc call

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/dirsize.c

    r779 r780  
    9999  ULONGLONG ull;
    100100  HDIR hdir;
    101   FILEFINDBUF4 *pffb;
     101  FILEFINDBUF4 *pffb, *pffbTemp;
    102102  APIRET rc;
    103103  RECORDINSERT ri;
     
    208208  }
    209209  hdir = HDIR_CREATE;
     210  pffbTemp = pffb;
    210211  nm = FilesToGet;
    211   pffb =
    212     xrealloc(pffb, (nm + 1) * sizeof(FILEFINDBUF4), pszSrcFile, __LINE__);
     212  pffb = xrealloc(pffb, (nm + 1) * sizeof(FILEFINDBUF4), pszSrcFile, __LINE__);
     213  if (!pffb) { //Error already sent
     214        free(pffbTemp);
     215        return FALSE;
     216      }
    213217  rc = DosFindFirst(maskstr, &hdir,
    214218                    FILE_NORMAL | FILE_READONLY | FILE_ARCHIVED |
     
    217221  if (!rc) {
    218222    register PBYTE fb = (PBYTE) pffb;
    219     FILEFINDBUF4 *pffbFile, *pffbTemp;
     223    FILEFINDBUF4 *pffbFile;
    220224    ULONG x;
    221225    UINT y = 1;
Note: See TracChangeset for help on using the changeset viewer.