mirror of
https://github.com/corda/corda.git
synced 2025-01-16 17:59:46 +00:00
fix off-by-one thinko in GetStringUTFChars; call dlclose() in ~Library()
This commit is contained in:
parent
25a7aae0f8
commit
da844719ab
2
makefile
2
makefile
@ -127,7 +127,7 @@ fast-cflags = $(fast) $(cflags)
|
|||||||
classpath-sources = $(shell find $(classpath)/java -name '*.java')
|
classpath-sources = $(shell find $(classpath)/java -name '*.java')
|
||||||
classpath-classes = $(call java-classes,$(classpath-sources),$(classpath))
|
classpath-classes = $(call java-classes,$(classpath-sources),$(classpath))
|
||||||
|
|
||||||
input = $(bld)/classes/TestExceptions.class
|
input = $(bld)/classes/Hello.class
|
||||||
input-depends = \
|
input-depends = \
|
||||||
$(classpath-classes) \
|
$(classpath-classes) \
|
||||||
$(jni-library)
|
$(jni-library)
|
||||||
|
10
src/main.cpp
10
src/main.cpp
@ -236,6 +236,12 @@ class System: public vm::System {
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void dispose() {
|
virtual void dispose() {
|
||||||
|
if (Verbose) {
|
||||||
|
fprintf(stderr, "close %p\n", p);
|
||||||
|
}
|
||||||
|
|
||||||
|
dlclose(p);
|
||||||
|
|
||||||
if (next_) {
|
if (next_) {
|
||||||
next_->dispose();
|
next_->dispose();
|
||||||
}
|
}
|
||||||
@ -335,6 +341,10 @@ class System: public vm::System {
|
|||||||
|
|
||||||
void* p = dlopen(buffer, RTLD_LAZY);
|
void* p = dlopen(buffer, RTLD_LAZY);
|
||||||
if (p) {
|
if (p) {
|
||||||
|
if (Verbose) {
|
||||||
|
fprintf(stderr, "open %s as %p\n", buffer, p);
|
||||||
|
}
|
||||||
|
|
||||||
*lib = new (vm::System::allocate(sizeof(Library)))
|
*lib = new (vm::System::allocate(sizeof(Library)))
|
||||||
Library(this, p, next);
|
Library(this, p, next);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2757,7 +2757,8 @@ GetStringUTFChars(JNIEnv* e, jstring s, jboolean* isCopy)
|
|||||||
|
|
||||||
char* chars = 0;
|
char* chars = 0;
|
||||||
if (LIKELY(s)) {
|
if (LIKELY(s)) {
|
||||||
chars = static_cast<char*>(t->vm->system->allocate(stringLength(t, *s)));
|
chars = static_cast<char*>
|
||||||
|
(t->vm->system->allocate(stringLength(t, *s) + 1));
|
||||||
|
|
||||||
memcpy(chars,
|
memcpy(chars,
|
||||||
&byteArrayBody(t, stringBytes(t, *s), stringOffset(t, *s)),
|
&byteArrayBody(t, stringBytes(t, *s), stringOffset(t, *s)),
|
||||||
|
Loading…
Reference in New Issue
Block a user