Repository : ssh://git@open-mesh.org/alfred
On branch : master
commit 40feacaaee72a3569018e966428d4a4455821630 Author: Sven Eckelmann sven@narfation.org Date: Sat May 24 13:44:08 2014 +0200
batadv-vis: Avoid memory leak when tl parsing failed
The parsing function for the local translation table can fail to convert the mac address and then jumps out of the function. This leaks the earlier allocated v_entry.
Signed-off-by: Sven Eckelmann sven@narfation.org Signed-off-by: Simon Wunderlich sw@simonwunderlich.de
40feacaaee72a3569018e966428d4a4455821630 vis/vis.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/vis/vis.c b/vis/vis.c index 9031b27..a5ac664 100644 --- a/vis/vis.c +++ b/vis/vis.c @@ -213,8 +213,10 @@ static int parse_transtable_local(struct globals *globals) continue;
mac = str_to_mac(tptr); - if (!mac) + if (!mac) { + free(v_entry); continue; + }
memcpy(v_entry->v.mac, mac, ETH_ALEN); v_entry->v.ifindex = 255;