Ticket #281: parse.C.diff

File parse.C.diff, 453 bytes (added by Joses, 17 years ago)

lib/parse.C has a similar problem - highlighted realloc()==NULL

  • parse.C

    old new  
    137137// append to a malloc'd string
    138138//
    139139int strcatdup(char*& p, char* buf) {
    140     p = (char*)realloc(p, strlen(p) + strlen(buf)+1);
    141     if (!p) {
     140    char* pt = (char*)realloc(p, strlen(p) + strlen(buf)+1);
     141    if (pt) {
     142        p = pt;
     143    } else {
     144        free(p);
    142145        return ERR_MALLOC;
    143146    }
    144147    strcat(p, buf);