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

Commit c4c0a713 authored by Ting-Yuan Huang's avatar Ting-Yuan Huang Committed by Josh Gao
Browse files

Fix a potential memory leak

Bug: 65648324
Test: Built without seeing the warnings
Change-Id: I934509c78482af9ef7dc447c807f6450484b4b38
(cherry picked from commit f26cf6d5)
parent c03127ef
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -481,11 +481,17 @@ asocket* host_service_to_socket(const char* name, const char* serial, TransportI
            return nullptr;
        }

        int fd = create_service_thread(wait_for_state, sinfo.release());
        int fd = create_service_thread(wait_for_state, sinfo.get());
        if (fd != -1) {
            sinfo.release();
        }
        return create_local_socket(fd);
    } else if (!strncmp(name, "connect:", 8)) {
        char* host = strdup(name + 8);
        int fd = create_service_thread(connect_service, host);
        if (fd == -1) {
            free(host);
        }
        return create_local_socket(fd);
    }
    return NULL;