From 511f8b8885241d026fb4656943424b91f04a7ddf Mon Sep 17 00:00:00 2001 From: Anton Lundin Date: Wed, 11 Dec 2013 00:53:31 +0100 Subject: [PATCH] Plug potential memory leak in try_to_xslt_open_csv Free temp buffer if realloc fails. Signed-off-by: Anton Lundin Signed-off-by: Dirk Hohndel --- file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/file.c b/file.c index a8c014235..1e141b708 100644 --- a/file.c +++ b/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, "", 7); mem->buffer = buf; mem->size += strlen(""); - } else + } else { + free(mem->buffer); return 1; + } return 0; }