Changeset 9f1b6ee for lib


Ignore:
Timestamp:
08/09/10 10:11:56 (11 years ago)
Author:
Shane Alcock <salcock@…>
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:
176646e
Parents:
a1e177d
Message:
  • Let's be a bit more careful about freeing things in the event of error inside of format_linux.c
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_linux.c

    rc69b593 r9f1b6ee  
    175175                trace_set_err(libtrace, errno, "Could not create raw socket");
    176176                free(libtrace->format_data);
     177                libtrace->format_data = NULL;
    177178                return -1;
    178179        }
     
    187188                        trace_set_err(libtrace, TRACE_ERR_INIT_FAILED, "Failed to find interface %s", libtrace->uridata);
    188189                        free(libtrace->format_data);
     190                        libtrace->format_data = NULL;
    189191                        return -1;
    190192                }
     
    197199                                (socklen_t)sizeof(addr))==-1) {
    198200                free(libtrace->format_data);
     201                libtrace->format_data = NULL;
    199202                trace_set_err(libtrace, errno, "Failed to bind to interface %s", libtrace->uridata);
    200203                return -1;
     
    305308static int linuxnative_fin_input(libtrace_t *libtrace)
    306309{
    307         if (FORMAT(libtrace->format_data)->filter != NULL)
    308                 free(FORMAT(libtrace->format_data)->filter);
    309         if (libtrace->format_data)
     310        if (libtrace->format_data) {
     311                if (FORMAT(libtrace->format_data)->filter != NULL)
     312                        free(FORMAT(libtrace->format_data)->filter);
    310313                free(libtrace->format_data);
     314        }
    311315       
    312316        return 0;
Note: See TracChangeset for help on using the changeset viewer.