Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 589f3e48 authored by George Burgess's avatar George Burgess Committed by Gerrit Code Review
Browse files

Merge "bit: avoid calling strdup(NULL)"

parents 9e70a83e d53c2740
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -192,10 +192,11 @@ exec_with_path_search(const char* prog, char const* const* argv, char const* con
    if (strchr(prog, '/') != NULL) {
        return execve(prog, (char*const*)argv, (char*const*)envp);
    } else {
        char* pathEnv = strdup(getenv("PATH"));
        if (pathEnv == NULL) {
        const char* pathEnvRaw = getenv("PATH");
        if (pathEnvRaw == NULL) {
            return 1;
        }
        char* pathEnv = strdup(pathEnvRaw);
        char* dir = pathEnv;
        while (dir) {
            char* next = strchr(dir, ':');