From: Todd C. Miller Date: Sat, 7 May 2016 10:59:56 +0000 (-0600) Subject: Fix memory leak in get_editor() if resolve_editor() fails with X-Git-Tag: SUDO_1_8_17^2~85 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bbda2e7b5b9e770c6022f6b3b2896c382ae2ff10;p=sudo Fix memory leak in get_editor() if resolve_editor() fails with an error. Coverity CID 104107. --- 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]);