From: Ben Pfaff Date: Sun, 14 Apr 2024 16:51:58 +0000 (-0700) Subject: SHOW: Fix memory leak on error path. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c9899f4be8c8461215424fd1249f78c9f1267e0;p=pspp SHOW: Fix memory leak on error path. --- diff --git a/src/language/commands/set.c b/src/language/commands/set.c index bca5521f4d..a2d8fa6ad2 100644 --- a/src/language/commands/set.c +++ b/src/language/commands/set.c @@ -1491,14 +1491,14 @@ cmd_show (struct lexer *lexer, struct dataset *ds) } } lex_error (lexer, _("Syntax error expecting the name of a setting.")); - return CMD_FAILURE; + goto error; found: ; } else { lex_error (lexer, _("Syntax error expecting the name of a setting.")); - return CMD_FAILURE; + goto error; } lex_match (lexer, T_SLASH); @@ -1509,6 +1509,10 @@ cmd_show (struct lexer *lexer, struct dataset *ds) pivot_table_submit (pt); return CMD_SUCCESS; + +error: + pivot_table_unref (pt); + return CMD_FAILURE; } #define MAX_SAVED_SETTINGS 5