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

Already on GitHub? Sign in to your account

Update src/redis-benchmark.c #707

Merged
merged 1 commit into from Oct 10, 2012

Conversation

Projects
None yet
2 participants
Contributor

NanXiao commented Oct 10, 2012

The code of current implementation:

if (c->pending == 0) clientDone(c);
In clientDone function, the c's memory has been freed, then the loop will continue: while(c->pending). The memory of c has been freed now, so c->pending is invalid (c is an invalid pointer now), and this will cause memory dump in some platforams(eg: Solaris).

So I think the code should be modified as:
if (c->pending == 0)
{
clientDone(c);
break;
}
and this will not lead to while(c->pending).

Update src/redis-benchmark.c
The code of current implementation:

if (c->pending == 0) clientDone(c);
In clientDone function, the c's memory has been freed, then the loop will continue: while(c->pending). The memory of c has been freed now, so c->pending is invalid (c is an invalid pointer now), and this will cause memory dump in some platforams(eg: Solaris).

So I think the code should be modified as:
if (c->pending == 0)
{
clientDone(c);
break;
}
and this will not lead to while(c->pending).
Owner

antirez commented Oct 10, 2012

Thanks! merged.

antirez added a commit that referenced this pull request Oct 10, 2012

Merge pull request #707 from NanXiao/patch-1
Update src/redis-benchmark.c

@antirez antirez merged commit d10a01b into antirez:unstable Oct 10, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment