Changeset d694056 for lib/trace.c


Ignore:
Timestamp:
09/18/06 23:11:38 (15 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:
3eff1c8
Parents:
279486e
Message:

More splint fixes, at least one is critical (returning a free'd pointer)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace.c

    r755e794 rd694056  
    117117static char *xstrndup(const char *src,size_t n)
    118118{       
    119         char *ret=(char*)malloc(n+1);
     119        char *ret=(restrict char*)malloc(n+1);
     120        if (ret==NULL) {
     121                fprintf(stderr,"Out of memory");
     122                exit(EXIT_FAILURE);
     123        }
    120124        xstrncpy(ret,src,n);
    121125        return ret;
     
    294298
    295299        assert(uri && "Passing NULL to trace_create makes me a very sad program");
     300
     301        if (!libtrace) {
     302                /* Out of memory */
     303                return NULL;
     304        }
    296305       
    297306        libtrace->err.err_num = TRACE_ERR_NOERROR;
     
    458467                switch(libtrace->format->init_output(libtrace)) {
    459468                        case -1: /* failure */
    460                                 free(libtrace);
    461469                                return libtrace;
    462470                        case 0: /* success */
Note: See TracChangeset for help on using the changeset viewer.