summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2013-06-13 16:45:54 +0200
committerTobias Klauser <tklauser@distanz.ch>2013-06-13 16:45:54 +0200
commitbdf2285959f985bb1d9a92ba22eefadc6d85a393 (patch)
treea9531ba2693ae4403d5fdcd851cd5eeb2aebeae2
parentffc485dbcab01699fdbe8d9cf3da6a3f2bbed698 (diff)
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 <tklauser@distanz.ch>
-rw-r--r--oui.c8
1 files 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');