add: if (!re) { LOG(L_WARN, "warning: mediaproxy/checkAsymmetricFile(): " "cannot allocate memory for all the %s asymmetric " "clients listed in file. Some of them will not be " "handled properly.\n", which); break; }
context: checkAsymmetricFile(AsymmetricClients *aptr){    char buf[512], errbuf[256], *which;    regex_t *re, **regs;    int i, size, code;    Bool firstTime = False;    struct stat statbuf;    FILE *file;    str line;    if (stat(aptr->file, &statbuf) < 0)        return; // ignore missing file    if (statbuf.st_mtime <= aptr->timestamp)        return; // not changed    // now we have work to do    which = (aptr == &sipAsymmetrics ? "SIP" : "RTP");    if (!aptr->clients) {        // if we are here the first time allocate memory to hold the regexps        // initial size of array        // (hopefully not reached so we won't need to realloc)        size = 32;        aptr->clients = (regex_t**)pkg_malloc(size*sizeof(regex_t**));        if (!aptr->clients) {            LOG(L_WARN, "warning: mediaproxy/checkAsymmetricFile() cannot "                "allocate memory for the %s asymmetric client list. "                "%s asymmetric clients will not be handled properly.\n",                which, which);            return; // ignore as it is not fatal        }        aptr->size  = size;        aptr->count = 0;        firstTime = True;    } else {        // else clean old stuff        for (i=0; i<aptr->count; i++) {            regfree(aptr->clients[i]);            pkg_free(aptr->clients[i]);            aptr->clients[i] = NULL;        }        aptr->count = 0;    }    // read new    file = fopen(aptr->file, "r");    i = 0; // this will count on which line are we in the file    while (!feof(file)) {        if (!fgets(buf, 512, file))            break;        i++;        line.s = buf;        line.len = strlen(buf);        trim(&line);        if (line.len == 0 || line.s[0] == '#')            continue; // comment or empty line. ignore        line.s[line.len] = 0;        re = (regex_t*)pkg_malloc(sizeof(regex_t));        code = regcomp(re, line.s, REG_EXTENDED|REG_ICASE|REG_NOSUB);        if (code == 0) {            if (aptr->count+1 > aptr->size) {                size = aptr->size * 2;                regs = aptr->clients;                regs = (regex_t**)pkg_realloc(regs, size*sizeof(regex_t**));                if (!regs) {                    LOG(L_WARN, "warning: mediaproxy/checkAsymmetricFile(): "                        "cannot allocate memory for all the %s asymmetric "                        "clients listed in file. Some of them will not be "                        "handled properly.\n", which);                    break;                }                aptr->clients = regs;                aptr->size = size;            }            aptr->clients[aptr->count] = re;            aptr->count++;        } else {            regerror(code, re, errbuf, 256);            LOG(L_WARN, "warning: mediaproxy/checkAsymmetricFile(): cannot "                "compile line %d of the %s asymmetric clients file into a "                "regular expression (will be ignored): %s", i, which, errbuf);            pkg_free(re);        }    }    aptr->timestamp = statbuf.st_mtime;    LOG(L_INFO, "info: mediaproxy: %sloaded %s asymmetric clients file "        "containing %d entr%s.\n", firstTime ? "" : "re",        which, aptr->count, aptr->count==1 ? "y" : "ies");}