The recvCallBack() could sometimes be invoked even after subscription's
destruction. In order to avoid dereferencing pointer to free()'d memory we
use this 'intermediary' pointer and during subscription destruction we
set it to null and test this value in recvCallBack().
JORTECallbackContext_t *callback_cont;
JORTECallbackContext_t *callback_cont;
- // if the subscriber has been destroyed, return
+ // HACK: if the subscriber has been destroyed, return
if ((*(JORTECallbackContext_t **)recvCallBackParam) == 0)
return;
if ((*(JORTECallbackContext_t **)recvCallBackParam) == 0)
return;
void *buffer;
int flag_ok = 0;
void *buffer;
int flag_ok = 0;
+ /* HACK: allocate space for callback context structure and than for a pointer to it */
+
// memory alocation
// don't forget use free() funct.!!
callback_cont = (JORTECallbackContext_t *)malloc(sizeof(JORTECallbackContext_t));
// memory alocation
// don't forget use free() funct.!!
callback_cont = (JORTECallbackContext_t *)malloc(sizeof(JORTECallbackContext_t));
if (h) {
//JavaVM *jvm;
//jint ret;
if (h) {
//JavaVM *jvm;
//jint ret;
JORTECallbackContext_t *ctx = *((JORTECallbackContext_t **)h);
*((JORTECallbackContext_t **)h) = 0;
JORTECallbackContext_t *ctx = *((JORTECallbackContext_t **)h);
*((JORTECallbackContext_t **)h) = 0;
if (ctx->obj) {
#ifdef TEST_STAGE
printf(":c: deleting ctx->obj \n");
if (ctx->obj) {
#ifdef TEST_STAGE
printf(":c: deleting ctx->obj \n");