int HelloworldRand_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
RedisModule_AutoMemory(ctx);
if(argc>=2) {
size_t len=1024;
const char* help=RedisModule_StringPtrLen(argv[1],&len);
RedisModule_ReplyWithString(ctx, help);
return REDISMODULE_OK;
}
if(argc==1) {
RedisModule_ReplyWithLongLong(ctx, argc);
return REDISMODULE_ERR;
}
}
Here is my custom module command,When I use my own command in redis-cli like enter helloworld.rand 123456, the redis-server has a memory error and shuts down directly,Can someone see what is wrong with my custom command
Comment From: MasterL-min
I am so sorry that i use the ReplyWithString without use the ReplyWithSimpleString to reply a char* to client.