]> granicus.if.org Git - sudo/commitdiff
Fix memory leak in get_editor() if resolve_editor() fails with
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 7 May 2016 10:59:56 +0000 (04:59 -0600)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 7 May 2016 10:59:56 +0000 (04:59 -0600)
an error.  Coverity CID 104107.

plugins/sudoers/visudo.c

index 320c2e6079646774bdb391cf21d9c90df3561e16..1e594589a42fe1bfda08e9685d47952701d32807 100644 (file)
@@ -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]);