fix leak in cron

Former-commit-id: c1f4e344bdaf21bc74fae6e1b0cb7fc1ce687e62
This commit is contained in:
John Sully 2020-01-29 19:03:18 -05:00
parent 36f497a1a5
commit 96c5ffdc86
2 changed files with 4 additions and 1 deletions

View File

@ -130,7 +130,9 @@ struct aeCommand
void *clientData;
aeCommandControl *pctl;
};
#ifdef PIPE_BUF
static_assert(sizeof(aeCommand) <= PIPE_BUF);
#endif
void aeProcessCmd(aeEventLoop *eventLoop, int fd, void *, int )
{

View File

@ -67,6 +67,7 @@ void cronCommand(client *c)
robj *o = createObject(OBJ_CRON, spjob.release());
setKey(c->db, c->argv[ARG_NAME], o);
decrRefCount(o);
// use an expire to trigger execution. Note: We use a subkey expire here so legacy clients don't delete it.
setExpire(c, c->db, c->argv[ARG_NAME], c->argv[ARG_NAME], base + interval);
addReply(c, shared.ok);
@ -102,7 +103,7 @@ void executeCronJobExpireHook(const char *key, robj *o)
int dbId = job->dbNum;
if (job->fSingleShot)
{
dbSyncDelete(cFake->db, keyobj);
serverAssert(dbSyncDelete(cFake->db, keyobj));
}
else
{