From bbda2e7b5b9e770c6022f6b3b2896c382ae2ff10 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Sat, 7 May 2016 04:59:56 -0600 Subject: [PATCH] Fix memory leak in get_editor() if resolve_editor() fails with an error. Coverity CID 104107. --- plugins/sudoers/visudo.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c index 320c2e607..1e594589a 100644 --- a/plugins/sudoers/visudo.c +++ b/plugins/sudoers/visudo.c @@ -331,12 +331,13 @@ get_editor(int *editor_argc, char ***editor_argv) if (editor_path != NULL) break; if (errno != ENOENT) - debug_return_str(NULL); + goto done; } } if (editor_path == NULL) sudo_fatalx(U_("no editor found (editor path = %s)"), def_editor); +done: if (whitelist != NULL) { while (whitelist_len--) free(whitelist[whitelist_len]); -- 2.40.0