SF 1674179 enum variant leak. also affects 1112667 1465539 1569864
This commit is contained in:
@@ -81,6 +81,10 @@ Java_com_jacob_com_EnumVariant_Next(JNIEnv* env, jobject _this, jobjectArray var
|
||||
VariantCopy(v, sink + idx);
|
||||
env->SetObjectArrayElement(vars, idx, newVariant);
|
||||
env->DeleteLocalRef(newVariant);
|
||||
//Sourceforge-1674179 fix memory leak
|
||||
// Variants received while iterating IEnumVARIANT must be cleared when no longer needed
|
||||
// The variant has been copied so no longer needed
|
||||
VariantClear(sink);
|
||||
}
|
||||
CoTaskMemFree(sink);
|
||||
return (jint)fetchCount;
|
||||
|
||||
@@ -181,7 +181,9 @@ JNIEXPORT jobject JNICALL Java_com_jacob_com_Variant_toEnumVariant
|
||||
return NULL;
|
||||
}
|
||||
// I am copying the pointer to java
|
||||
if (ie) ie->AddRef();
|
||||
// SF-1674179 fix EnumVariants memory leak
|
||||
// AJ: yes, but the QueryInterface call above already incremented the reference
|
||||
//if (ie) ie->AddRef();
|
||||
jobject newAuto = env->NewObject(autoClass, autoCons, ie);
|
||||
return newAuto;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user