Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time event next id auto increment if any error happened #3318

Open
runrunwang opened this issue Jun 16, 2016 · 0 comments
Open

Time event next id auto increment if any error happened #3318

runrunwang opened this issue Jun 16, 2016 · 0 comments

Comments

@runrunwang
Copy link

long long aeCreateTimeEvent(aeEventLoop *eventLoop, long long milliseconds,
        aeTimeProc *proc, void *clientData,
        aeEventFinalizerProc *finalizerProc)
{
    long long id = eventLoop->timeEventNextId++;
    aeTimeEvent *te;

    te = zmalloc(sizeof(*te)); 
    if (te == NULL) return AE_ERR; 
    .......
}

when te structure can not be allocated, this function return a error with timeEventNextId auto incremented. i think first check whether memory allocation is successful, and then auto increment might be a better option.

@runrunwang runrunwang changed the title Time event next id should auto increment if any error happened Time event next id auto increment if any error happened Jun 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant