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

Commit 980bdf2b authored by Yuxiu Zhang's avatar Yuxiu Zhang Committed by Lin Lili
Browse files

libdatasource: fix null dereference

mediaHTTP can be NULL when failed to make http connection
from http service, and then mediaHTTP->connect() will crash.
check if mediaHTTP is NULL before calling mediaHTTP->connect().

Bug: 186381982
Change-Id: I936baf9fbbb2001f8f48f0f1c15f6bc08513600a
Test: http streaming ut
parent 85ed8fd8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -65,6 +65,9 @@ sp<DataSource> DataSourceFactory::CreateFromURI(
        sp<HTTPBase> mediaHTTP = httpSource;
        if (mediaHTTP == NULL) {
            mediaHTTP = static_cast<HTTPBase *>(CreateMediaHTTP(httpService).get());
            if (mediaHTTP == NULL) {
                return NULL;
            }
        }

        String8 cacheConfig;