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

Commit bb9c2e11 authored by Hung Nguyen's avatar Hung Nguyen Committed by James Dong
Browse files

Fixed memory leakage in the DRM framework

Change-Id: Ib1276bec6cafb4e94f8f13b52e50e4987765eec4
parent b7a56193
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -190,8 +190,9 @@ DrmConstraints* BpDrmManagerService::getConstraints(
            if (0 < bufferSize) {
                data = new char[bufferSize];
                reply.read(data, bufferSize);
            }
                drmConstraints->put(&key, data);
                delete[] data;
            }
        }
    }
    return drmConstraints;
@@ -219,8 +220,9 @@ DrmMetadata* BpDrmManagerService::getMetadata(int uniqueId, const String8* path)
            if (0 < bufferSize) {
                data = new char[bufferSize];
                reply.read(data, bufferSize);
            }
                drmMetadata->put(&key, data);
                delete[] data;
            }
        }
    }
    return drmMetadata;
@@ -889,9 +891,11 @@ status_t BnDrmManagerService::onTransact(
                int bufferSize = 0;
                if (NULL != value) {
                    bufferSize = strlen(value);
                }
                    reply->writeInt32(bufferSize + 1);
                    reply->write(value, bufferSize + 1);
                } else {
                    reply->writeInt32(0);
                }
            }
        }
        delete drmConstraints; drmConstraints = NULL;
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ String8 ReadWriteUtils::readBytes(const String8& filePath) {
            if (length == read(fd, (void*) bytes, length)) {
                string.append(bytes, length);
            }
            delete bytes;
            delete[] bytes;
        }
        fclose(file);
    }
+2 −1
Original line number Diff line number Diff line
@@ -65,10 +65,11 @@ DrmConstraints* DrmPassthruPlugIn::onGetConstraints(
    char* charValue = NULL;
    charValue = new char[value.length() + 1];
    strncpy(charValue, value.string(), value.length());
    charValue[value.length()] = '\0';

    //Just add dummy available time for verification
    drmConstraints->put(&(DrmConstraints::LICENSE_AVAILABLE_TIME), charValue);

    delete[] charValue;
    return drmConstraints;
}