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) {
|
if (0 < bufferSize) {
|
||||||
data = new char[bufferSize];
|
data = new char[bufferSize];
|
||||||
reply.read(data, bufferSize);
|
reply.read(data, bufferSize);
|
||||||
|
drmConstraints->put(&key, data);
|
||||||
|
delete[] data;
|
||||||
}
|
}
|
||||||
drmConstraints->put(&key, data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return drmConstraints;
|
return drmConstraints;
|
||||||
@@ -219,8 +220,9 @@ DrmMetadata* BpDrmManagerService::getMetadata(int uniqueId, const String8* path)
|
|||||||
if (0 < bufferSize) {
|
if (0 < bufferSize) {
|
||||||
data = new char[bufferSize];
|
data = new char[bufferSize];
|
||||||
reply.read(data, bufferSize);
|
reply.read(data, bufferSize);
|
||||||
|
drmMetadata->put(&key, data);
|
||||||
|
delete[] data;
|
||||||
}
|
}
|
||||||
drmMetadata->put(&key, data);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return drmMetadata;
|
return drmMetadata;
|
||||||
@@ -889,9 +891,11 @@ status_t BnDrmManagerService::onTransact(
|
|||||||
int bufferSize = 0;
|
int bufferSize = 0;
|
||||||
if (NULL != value) {
|
if (NULL != value) {
|
||||||
bufferSize = strlen(value);
|
bufferSize = strlen(value);
|
||||||
|
reply->writeInt32(bufferSize + 1);
|
||||||
|
reply->write(value, bufferSize + 1);
|
||||||
|
} else {
|
||||||
|
reply->writeInt32(0);
|
||||||
}
|
}
|
||||||
reply->writeInt32(bufferSize + 1);
|
|
||||||
reply->write(value, bufferSize + 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete drmConstraints; drmConstraints = NULL;
|
delete drmConstraints; drmConstraints = NULL;
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ String8 ReadWriteUtils::readBytes(const String8& filePath) {
|
|||||||
if (length == read(fd, (void*) bytes, length)) {
|
if (length == read(fd, (void*) bytes, length)) {
|
||||||
string.append(bytes, length);
|
string.append(bytes, length);
|
||||||
}
|
}
|
||||||
delete bytes;
|
delete[] bytes;
|
||||||
}
|
}
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,10 +65,11 @@ DrmConstraints* DrmPassthruPlugIn::onGetConstraints(
|
|||||||
char* charValue = NULL;
|
char* charValue = NULL;
|
||||||
charValue = new char[value.length() + 1];
|
charValue = new char[value.length() + 1];
|
||||||
strncpy(charValue, value.string(), value.length());
|
strncpy(charValue, value.string(), value.length());
|
||||||
|
charValue[value.length()] = '\0';
|
||||||
|
|
||||||
//Just add dummy available time for verification
|
//Just add dummy available time for verification
|
||||||
drmConstraints->put(&(DrmConstraints::LICENSE_AVAILABLE_TIME), charValue);
|
drmConstraints->put(&(DrmConstraints::LICENSE_AVAILABLE_TIME), charValue);
|
||||||
|
delete[] charValue;
|
||||||
return drmConstraints;
|
return drmConstraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user