From: John Darrington Date: Wed, 3 Feb 2016 08:25:11 +0000 (+0100) Subject: Fix memory leak in SYSFILE command X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=6efc5f2f58620c55fe9bed4522feb6f4a30891e0;p=pspp Fix memory leak in SYSFILE command --- 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;