diff options
Diffstat (limited to 'omapip')
-rw-r--r-- | omapip/test.c | 7 | ||||
-rw-r--r-- | omapip/trace.c | 6 |
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)) |