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

Commit 3c8443ed authored by Abinath S's avatar Abinath S
Browse files

hal: sndmonitor: Fix for Code vulnerability

Free the state pointer after printing state.

Change-Id: I718c7d4462f7dc090c177497fd1674e6119bec57
parent ee821931
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -166,13 +166,13 @@ static int add_new_sndcard(int card, int fd)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 15, 0))
    bool online = state && !strcmp(state, "ONLINE");

    if (state)
        free(state);
#else
    bool online = atoi(state);
#endif

    ALOGV("card %d initial state %s %d", card, state, online);
    if (state)
        free(state);

    s->status = online ? CARD_STATUS_ONLINE : CARD_STATUS_OFFLINE;
    list_add_tail(&sndmonitor.cards, &s->node);