The read_file function opens the file and thus has to close the filehandler after an realloc error. This was forgotten in the fix 0ad384e11ed039d4c3025a7eaf19fe6bcfd41acf ("batadv-vis: Avoid memory leak after failed realloc").
Signed-off-by: Sven Eckelmann sven@narfation.org --- vis/vis.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/vis/vis.c b/vis/vis.c index f429942..55c2dad 100644 --- a/vis/vis.c +++ b/vis/vis.c @@ -56,6 +56,7 @@ static char *read_file(char *fname) buf_tmp = realloc(buf, size + 4097); if (!buf_tmp) { free(buf); + fclose(fp); return NULL; }
The read_file function opens the file and thus has to close the filehandler after an realloc error. This was forgotten in the fix 0ad384e11ed039d4c3025a7eaf19fe6bcfd41acf ("batadv-vis: Avoid memory leak after failed realloc").
Applied in revision 3b72283
Thanks, Simon
b.a.t.m.a.n@lists.open-mesh.org