commit f645009a5ee3f987c43abfd78e3dae90ffa04d55
parent 2b2736d41a6eb8f3d5c4bce262cd92671626fcaf
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Thu, 11 Apr 2019 10:05:39 +0200
tweaks: free the result string from an invocation error [coverity]
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git 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;
}