don't use sizeof on malloc'd pointer

This commit is contained in:
Malavan Sotheeswaran 2023-02-14 18:23:35 -08:00
parent 819bcc1f2a
commit 045cc52c1f

View File

@ -51,8 +51,9 @@ int TimerCommand_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int
for (int j = 0; j < 10; j++) {
int delay = rand() % 5000;
char *buf = RedisModule_Alloc(256);
snprintf(buf,sizeof(buf),"After %d", delay);
int bufsize = 256;
char *buf = RedisModule_Alloc(bufsize);
snprintf(buf,bufsize,"After %d", delay);
RedisModuleTimerID tid = RedisModule_CreateTimer(ctx,delay,timerHandler,buf);
REDISMODULE_NOT_USED(tid);
}