From f645009a5ee3f987c43abfd78e3dae90ffa04d55 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 11 Apr 2019 10:05:39 +0200 Subject: [PATCH] tweaks: free the result string from an invocation error [coverity] --- src/text.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/text.c b/src/text.c index f7a6c1e0..724f3906 100644 --- a/src/text.c +++ b/src/text.c @@ -2706,7 +2706,7 @@ void do_spell(void) char *temp; unsigned stash[sizeof(flags) / sizeof(flags[0])]; /* A storage place for the current flag settings. */ - const char *result_msg; + char *result_msg; if (ISSET(RESTRICTED)) { show_restricted_warning(); @@ -2760,6 +2760,7 @@ void do_spell(void) else statusline(ALERT, _("Spell checking failed: %s: %s"), result_msg, strerror(errno)); + free(result_msg); } else statusbar(_("Finished checking spelling")); } @@ -2945,7 +2946,10 @@ void do_linter(void) waitpid(pid_lint, &lint_status, 0); if (!WIFEXITED(lint_status) || WEXITSTATUS(lint_status) > 2) { - statusbar(invocation_error(openfile->syntax->linter)); + char *result_msg= invocation_error(openfile->syntax->linter); + + statusbar(result_msg); + free(result_msg); return; }