From 6efc5f2f58620c55fe9bed4522feb6f4a30891e0 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Wed, 3 Feb 2016 09:25:11 +0100 Subject: [PATCH] Fix memory leak in SYSFILE command --- src/language/dictionary/sys-file-info.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/language/dictionary/sys-file-info.c b/src/language/dictionary/sys-file-info.c index 862d989a6b..92ade932ef 100644 --- a/src/language/dictionary/sys-file-info.c +++ b/src/language/dictionary/sys-file-info.c @@ -133,7 +133,10 @@ cmd_sysfile_info (struct lexer *lexer, struct dataset *ds UNUSED) any_reader = any_reader_open (h); if (!any_reader) - return CMD_FAILURE; + { + free (encoding); + return CMD_FAILURE; + } if (encoding && !strcasecmp (encoding, "detect")) { @@ -150,7 +153,8 @@ cmd_sysfile_info (struct lexer *lexer, struct dataset *ds UNUSED) report_encodings (h, pool, titles, ids, strings, n_strings); fh_unref (h); pool_destroy (pool); - + free (encoding); + return CMD_SUCCESS; } @@ -249,6 +253,7 @@ cmd_sysfile_info (struct lexer *lexer, struct dataset *ds UNUSED) dict_destroy (d); fh_unref (h); + free (encoding); any_read_info_destroy (&info); return CMD_SUCCESS; -- 2.30.2