mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Plug potential memory leak in try_to_xslt_open_csv
Free temp buffer if realloc fails. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
ef3a51f6ee
commit
511f8b8885
1 changed files with 3 additions and 1 deletions
4
file.c
4
file.c
|
@ -122,8 +122,10 @@ static int try_to_xslt_open_csv(const char *filename, struct memblock *mem, char
|
||||||
memcpy(mem->buffer + mem->size + 5, "</csv>", 7);
|
memcpy(mem->buffer + mem->size + 5, "</csv>", 7);
|
||||||
mem->buffer = buf;
|
mem->buffer = buf;
|
||||||
mem->size += strlen("<csv></csv>");
|
mem->size += strlen("<csv></csv>");
|
||||||
} else
|
} else {
|
||||||
|
free(mem->buffer);
|
||||||
return 1;
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue