Changeset 52cc59f


Ignore:
Timestamp:
09/12/07 16:35:55 (14 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
9e6b38b
Parents:
0aae8f4
Message:

Don't crash when destroying an output trace that failed to initialise

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    r9bc4689 r52cc59f  
    422422        libtrace->err.err_num = TRACE_ERR_NOERROR;
    423423        strcpy(libtrace->err.problem,"Error message set\n");
     424        libtrace->format = NULL;
     425        libtrace->uridata = NULL;
    424426       
    425427        /* parse the URI to determine what sort of event we are dealing with */
     
    431433        }
    432434       
    433         libtrace->format = NULL;
    434435        for(tmp=formats_list;tmp;tmp=tmp->next) {
    435436                if (strlen(scan) == strlen(tmp->name) &&
     
    441442                                }
    442443        }
     444        free(scan);
     445
    443446        if (libtrace->format == NULL) {
    444447                trace_set_err_out(libtrace,TRACE_ERR_BAD_FORMAT,
     
    447450        }
    448451        libtrace->uridata = strdup(uridata);
    449 
    450452
    451453        /* libtrace->format now contains the type of uri
     
    470472
    471473
    472         free(scan);
    473474        libtrace->started=false;
    474475        return libtrace;
     
    628629        if (libtrace->format)
    629630                libtrace->format->fin_output(libtrace);
    630         free(libtrace->uridata);
     631        if (libtrace->uridata)
     632                free(libtrace->uridata);
    631633        free(libtrace);
    632634}
Note: See TracChangeset for help on using the changeset viewer.