@@ -107,19 +107,24 @@ static void *RAI_Model_RdbLoad(struct RedisModuleIO *io, int encver) {
107107 return NULL ;
108108 }
109109
110+ for (size_t i = 0 ; i < ninputs ; i ++ ) {
111+ RedisModule_Free (inputs [i ]);
112+ }
113+ for (size_t i = 0 ; i < noutputs ; i ++ ) {
114+ RedisModule_Free (outputs [i ]);
115+ }
110116 RedisModule_Free (inputs );
111117 RedisModule_Free (outputs );
112118 RedisModule_Free (buffer );
113119
114120 RedisModuleCtx * stats_ctx = RedisModule_GetContextFromIO (io );
115121 RedisModuleString * stats_keystr =
116122 RedisModule_CreateStringFromString (stats_ctx , RedisModule_GetKeyNameFromIO (io ));
117- const char * stats_devicestr = RedisModule_Strdup (devicestr );
118- RedisModuleString * stats_tag = RAI_HoldString (NULL , tag );
119123
120- model -> infokey =
121- RAI_AddStatsEntry (stats_ctx , stats_keystr , RAI_MODEL , backend , stats_devicestr , stats_tag );
124+ model -> infokey = RAI_AddStatsEntry (stats_ctx , stats_keystr , RAI_MODEL , backend , devicestr , tag );
122125
126+ RedisModule_FreeString (NULL , tag );
127+ RedisModule_Free (devicestr );
123128 RedisModule_FreeString (NULL , stats_keystr );
124129
125130 return model ;
@@ -371,7 +376,6 @@ void RAI_ModelFree(RAI_Model *model, RAI_Error *err) {
371376 }
372377
373378 RedisModule_FreeString (NULL , model -> tag );
374-
375379 RAI_RemoveStatsEntry (model -> infokey );
376380
377381 RedisModule_Free (model );
0 commit comments