diff options
author | Shawn Routhier <sar@isc.org> | 2012-10-16 15:05:24 -0700 |
---|---|---|
committer | Shawn Routhier <sar@isc.org> | 2012-10-16 15:05:24 -0700 |
commit | 0f750c4fb19823f622cfde356ac7f7aa2c9a3427 (patch) | |
tree | fea3ccc473e35832e12a0a3d0a576ea9b2174846 /omapip/trace.c | |
parent | 881442e20f455fb1dc21600390cc5aecae08fd72 (diff) | |
download | isc-dhcp-0f750c4fb19823f622cfde356ac7f7aa2c9a3427.tar.gz |
[master]
[rt23833]
Clean up a number of items identified by the Coverity
static analysis tool. Runs courtesy of Red Hat.
Diffstat (limited to 'omapip/trace.c')
-rw-r--r-- | omapip/trace.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/omapip/trace.c b/omapip/trace.c index 9fd3fb5e..8e203cd4 100644 --- a/omapip/trace.c +++ b/omapip/trace.c @@ -5,6 +5,7 @@ transactions... */ /* + * Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2009-2010 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2001-2003 by Internet Software Consortium @@ -235,6 +236,7 @@ isc_result_t trace_write_packet_iov (trace_type_t *ttype, /* We have to swap out the data, because it may be read back on a machine of different endianness. */ + memset(&tmp, 0, sizeof(tmp)); tmp.type_index = htonl (ttype -> index); tmp.when = htonl (time ((time_t *)0)); /* XXX */ tmp.length = htonl (length); @@ -690,27 +692,30 @@ isc_result_t trace_get_file (trace_type_t *ttype, } result = trace_get_next_packet (&ttype, tpkt, buf, len, &max); + /* done with tpkt, free it */ + dfree (tpkt, MDL); if (result != ISC_R_SUCCESS) { - dfree (tpkt, MDL); - if (*buf) + if (*buf) { dfree (*buf, MDL); + *buf = NULL; + } return result; } /* Make sure the filename is right. */ if (strcmp (filename, *buf)) { log_error ("Read file %s when expecting %s", *buf, filename); + dfree (*buf, MDL); + *buf = NULL; + status = fsetpos (traceinfile, &curpos); if (status < 0) { log_error ("fsetpos in tracefile failed: %m"); - dfree (tpkt, MDL); - dfree (*buf, MDL); return DHCP_R_PROTOCOLERROR; } return ISC_R_UNEXPECTEDTOKEN; } - dfree (tpkt, MDL); return ISC_R_SUCCESS; } #endif /* TRACING */ |