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

Commit 5fdccc45 authored by George Burgess's avatar George Burgess Committed by Automerger Merge Worker
Browse files

Merge "bit: avoid calling strdup(NULL)" am: 589f3e48 am: 96c1b4bd

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1995590

Change-Id: Ia9ce5f63427a3ec9fdf92be93bd54b1f6be5f14f
parents eea0986f 96c1b4bd
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, ':');