Branch: Tag:

2017-07-22

2017-07-22 04:28:43 by Martin Nilsson <nilsson@fastmail.com>

Fix a few leaks on error.

249:    char *scan;    int flags;    short *exp2,*dest,c; +  ONERROR oerr;       if (exp == NULL)    FAIL("NULL argument");       exp2=xcalloc( (strlen(exp)+1), sizeof(short) ); -  +  SET_ONERROR(oerr, free, exp2);    for ( dest=exp2; (c=UCHARAT(exp++)); ) {    switch (c) {    case '(':
304:    /* Small enough for pointer-storage convention? */    if (regsize >= 32767L) /* Probably could be 65535L. */    { -  free(exp2); +     FAIL("regexp too big");    }   
312:    r = malloc(sizeof(regexp) + (unsigned) regsize);    if(!r)    { -  free(exp2); +     Pike_error(msg_out_of_mem);    }   
365:    }       exit_regcomp: -  free(exp2); +  CALL_AND_UNSET_ONERROR(oerr);    return r;   }