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

Commit 5caf5fdc authored by Zhizhou Yang's avatar Zhizhou Yang
Browse files

Fix MemoryLeak warning in frameworks/base/services

Fixed warning: Memory allocated by 'new' should be deallocated by
'delete', not free().

Bug: 31999593

Test: mmma framework/base/services, with WITH_TIDY and
WITH_STATIC_ANALYZER, the warning has gone.

Change-Id: Ib19fd2f210468b712ee72a4760d2abe8355c59e2
parent 0bf608ee
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -511,7 +511,7 @@ int startLoadAppTxn(uint64_t appId, int hubHandle) {

    if (!txnInfo || instanceId < 0) {
        returnId(instanceId);
        free(txnInfo);
        delete txnInfo;
        return -1;
    }

@@ -524,7 +524,7 @@ int startLoadAppTxn(uint64_t appId, int hubHandle) {

    if (db.txnManager.addTxn(CONTEXT_HUB_LOAD_APP, txnInfo) != 0) {
        returnId(instanceId);
        free(txnInfo);
        delete txnInfo;
        return -1;
    }

@@ -541,7 +541,7 @@ int startUnloadAppTxn(jint appInstanceHandle) {
    *txnData = appInstanceHandle;

    if (db.txnManager.addTxn(CONTEXT_HUB_UNLOAD_APP, txnData) != 0) {
        free(txnData);
        delete txnData;
        ALOGW("Cannot start transaction to unload app");
        return -1;
    }