don't use sizeof on malloc'd pointer
This commit is contained in:
parent
819bcc1f2a
commit
045cc52c1f
@ -51,8 +51,9 @@ int TimerCommand_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int
|
|||||||
|
|
||||||
for (int j = 0; j < 10; j++) {
|
for (int j = 0; j < 10; j++) {
|
||||||
int delay = rand() % 5000;
|
int delay = rand() % 5000;
|
||||||
char *buf = RedisModule_Alloc(256);
|
int bufsize = 256;
|
||||||
snprintf(buf,sizeof(buf),"After %d", delay);
|
char *buf = RedisModule_Alloc(bufsize);
|
||||||
|
snprintf(buf,bufsize,"After %d", delay);
|
||||||
RedisModuleTimerID tid = RedisModule_CreateTimer(ctx,delay,timerHandler,buf);
|
RedisModuleTimerID tid = RedisModule_CreateTimer(ctx,delay,timerHandler,buf);
|
||||||
REDISMODULE_NOT_USED(tid);
|
REDISMODULE_NOT_USED(tid);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user