Fixed memory leakage in the DRM framework
Change-Id: Ib1276bec6cafb4e94f8f13b52e50e4987765eec4
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user