summaryrefslogtreecommitdiff
path: root/omapip
diff options
context:
space:
mode:
authorThomas Markwalder <tmark@isc.org>2014-08-28 07:56:20 -0400
committerThomas Markwalder <tmark@isc.org>2014-08-28 08:12:30 -0400
commita07d99bbefd67a238b66341f84c6c63f7f35540e (patch)
tree07bb7bcc8187364b785423822ddcd8dde667319c /omapip
parent36e2c22493c0f2357aec2ccf4ed37c2eb676bc56 (diff)
downloadisc-dhcp-a07d99bbefd67a238b66341f84c6c63f7f35540e.tar.gz
[master] Corrects medium impact issues reported by Coverity.
Merges in rt36933
Diffstat (limited to 'omapip')
-rw-r--r--omapip/test.c7
-rw-r--r--omapip/trace.c6
2 files changed, 10 insertions, 3 deletions
diff --git a/omapip/test.c b/omapip/test.c
index f05896db..98437acd 100644
--- a/omapip/test.c
+++ b/omapip/test.c
@@ -53,7 +53,12 @@ int main (int argc, char **argv)
exit(1);
}
- omapi_init ();
+ status = omapi_init ();
+ if (status != ISC_R_SUCCESS) {
+ fprintf(stderr, "omapi_init failed: %s\n",
+ isc_result_totext(status));
+ exit(1);
+ }
if (argc > 1 && !strcmp (argv [1], "listen")) {
if (argc < 3) {
diff --git a/omapip/trace.c b/omapip/trace.c
index 23e4e506..f4115c14 100644
--- a/omapip/trace.c
+++ b/omapip/trace.c
@@ -606,7 +606,9 @@ isc_result_t trace_get_next_packet (trace_type_t **ttp,
paylen = tpkt -> length;
if (paylen % 8)
paylen += 8 - (tpkt -> length % 8);
- if (paylen > (*bufmax)) {
+
+ /* allocate a buffer if we need one or current buffer is too small */
+ if ((*buf == NULL) || (paylen > (*bufmax))) {
if ((*buf))
dfree ((*buf), MDL);
(*bufmax) = ((paylen + 1023) & ~1023U);
@@ -617,7 +619,7 @@ isc_result_t trace_get_next_packet (trace_type_t **ttp,
return ISC_R_NOMEMORY;
}
}
-
+
status = fread ((*buf), 1, paylen, traceinfile);
if (status < paylen) {
if (ferror (traceinfile))