@@ -584,7 +584,7 @@ static void MR_StepDone(Execution* e, void* pd) {
584584 size_t stepIndex = mr_BufferReaderReadLongLong (& reader , NULL );
585585
586586 RedisModule_ThreadSafeContextLock (mr_staticCtx );
587- RedisModule_FreeString (NULL , payload );
587+ RedisModule_FreeString (mr_staticCtx , payload );
588588 RedisModule_ThreadSafeContextUnlock (mr_staticCtx );
589589
590590 if (MR_PerformStepDoneOp (e , stepIndex ) == MR_ClusterGetSize () - 1 ){
@@ -616,7 +616,7 @@ static void MR_SetRecord(Execution* e, void* pd) {
616616 Record * r = MR_RecordDeSerialize (& reader );
617617
618618 RedisModule_ThreadSafeContextLock (mr_staticCtx );
619- RedisModule_FreeString (NULL , payload );
619+ RedisModule_FreeString (mr_staticCtx , payload );
620620 RedisModule_ThreadSafeContextUnlock (mr_staticCtx );
621621
622622 if (MR_SetRecordToStep (e , stepIndex , r ) > 10000 ){
@@ -647,7 +647,7 @@ static void MR_PassRecord(RedisModuleCtx *ctx, const char *sender_id, uint8_t ty
647647 }
648648
649649 /* run the execution on the thread pool */
650- MR_ExecutionAddTask (e , MR_SetRecord , RedisModule_HoldString (NULL , payload ));
650+ MR_ExecutionAddTask (e , MR_SetRecord , RedisModule_HoldString (mr_staticCtx , payload ));
651651}
652652
653653static void MR_SendRecordToSlot (Execution * e , Step * s , Record * r , size_t slot ) {
@@ -701,7 +701,7 @@ static void MR_NotifyStepDone(RedisModuleCtx *ctx, const char *sender_id, uint8_
701701 }
702702
703703 /* run the execution on the thread pool */
704- MR_ExecutionAddTask (e , MR_StepDone , RedisModule_HoldString (NULL , payload ));
704+ MR_ExecutionAddTask (e , MR_StepDone , RedisModule_HoldString (mr_staticCtx , payload ));
705705}
706706
707707static Record * MR_RunReshuffleStep (Execution * e , Step * s ) {
@@ -1140,7 +1140,7 @@ static void MR_RecieveExecution(void* pd) {
11401140 * Possible optimization would be to batch multiple
11411141 * payloads into one GIL locking */
11421142 RedisModule_ThreadSafeContextLock (mr_staticCtx );
1143- RedisModule_FreeString (NULL , payload );
1143+ RedisModule_FreeString (mr_staticCtx , payload );
11441144 RedisModule_ThreadSafeContextUnlock (mr_staticCtx );
11451145
11461146 /* Finish deserializing the execution, we need to
@@ -1154,7 +1154,7 @@ static void MR_RecieveExecution(void* pd) {
11541154static void MR_NewExecutionRecieved (RedisModuleCtx * ctx , const char * sender_id , uint8_t type , RedisModuleString * payload ) {
11551155 /* We can directly move the job to the thread pool.
11561156 * We need to deserialize the execution and reply to the initiator. */
1157- mr_thpool_add_work (mrCtx .executionsThreadPool , MR_RecieveExecution , RedisModule_HoldString (NULL , payload ));
1157+ mr_thpool_add_work (mrCtx .executionsThreadPool , MR_RecieveExecution , RedisModule_HoldString (mr_staticCtx , payload ));
11581158}
11591159
11601160static void MR_ExecutionStepSerialize (mr_BufferWriter * buffWriter , Step * s ) {
0 commit comments