summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drm/common/IDrmManagerService.cpp12
-rw-r--r--drm/common/ReadWriteUtils.cpp2
-rw-r--r--drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp3
3 files changed, 11 insertions, 6 deletions
diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp
index 0282036..91fd91e 100644
--- a/drm/common/IDrmManagerService.cpp
+++ b/drm/common/IDrmManagerService.cpp
@@ -190,8 +190,9 @@ DrmConstraints* BpDrmManagerService::getConstraints(
if (0 < bufferSize) {
data = new char[bufferSize];
reply.read(data, bufferSize);
+ drmConstraints->put(&key, data);
+ delete[] data;
}
- drmConstraints->put(&key, 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;
}
- drmMetadata->put(&key, 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);
}
- reply->writeInt32(bufferSize + 1);
- reply->write(value, bufferSize + 1);
}
}
delete drmConstraints; drmConstraints = NULL;
diff --git a/drm/common/ReadWriteUtils.cpp b/drm/common/ReadWriteUtils.cpp
index fd17e98..d696f16 100644
--- a/drm/common/ReadWriteUtils.cpp
+++ b/drm/common/ReadWriteUtils.cpp
@@ -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);
}
diff --git a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
index fa659fd..084e323 100644
--- a/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
+++ b/drm/libdrmframework/plugins/passthru/src/DrmPassthruPlugIn.cpp
@@ -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;
}