Fix JNI leak in copyStringToBuffer

Bug: 5244396

Code was acquiring the char array twice for FIELD_TYPE_INTEGER
or FIELD_TYPE_FLOAT but only releasing it once.

Removed the redundant calls to GetCharArrayElements.

Change-Id: If767d3295d5a663a823e5ca0cd979379a3ccd024
This commit is contained in:
Jeff Brown
2011-08-31 16:09:24 -07:00
parent 9ee285afe7
commit f786b6ca5d

View File

@ -352,7 +352,6 @@ LOG_WINDOW("Copying string for %d,%d from %p", row, column, window);
char buf[32];
int len;
snprintf(buf, sizeof(buf), "%lld", value);
jchar* dst = env->GetCharArrayElements(buffer, NULL);
sizeCopied = charToJchar(buf, dst, bufferSize);
}
} else if (type == FIELD_TYPE_FLOAT) {
@ -360,7 +359,6 @@ LOG_WINDOW("Copying string for %d,%d from %p", row, column, window);
if (window->getDouble(row, column, &value)) {
char tempbuf[32];
snprintf(tempbuf, sizeof(tempbuf), "%g", value);
jchar* dst = env->GetCharArrayElements(buffer, NULL);
sizeCopied = charToJchar(tempbuf, dst, bufferSize);
}
} else if (type == FIELD_TYPE_NULL) {