From bdf2285959f985bb1d9a92ba22eefadc6d85a393 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Thu, 13 Jun 2013 16:45:54 +0200 Subject: oui: Free allocated record if line is skipped We would currently leak the record in case we skip a line, fix this by xfree()ing the memory in these cases. Signed-off-by: Tobias Klauser --- oui.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/oui.c b/oui.c index 5eea9fb..b537e1e 100644 --- a/oui.c +++ b/oui.c @@ -56,13 +56,17 @@ void dissector_init_oui(void) v = xmalloc(sizeof(*v)); v->id = strtol(ptr, &end, 0); /* not a valid line, skip */ - if (v->id == 0 && end == ptr) + if (v->id == 0 && end == ptr) { + xfree(v); continue; + } ptr = strstr(buff, ", "); /* likewise */ - if (!ptr) + if (!ptr) { + xfree(v); continue; + } ptr += strlen(", "); ptr = strtrim_right(ptr, '\n'); -- cgit v1.2.3-54-g00ecf