Skip to content

call freeFakeClientArgv when aof format error#6054

Closed
ShooterIT wants to merge 1 commit intoredis:unstablefrom
ShooterIT:aof-fmterr
Closed

call freeFakeClientArgv when aof format error#6054
ShooterIT wants to merge 1 commit intoredis:unstablefrom
ShooterIT:aof-fmterr

Conversation

@ShooterIT
Copy link
Member

In aof.c:675

if (buf[0] != '$') goto fmterr;

It will goto fmterr when the aof is bad file format, but the memory of argv isn't freed. We should free fake client‘s argv firstly.

Copy link
Member

@itamarhaber itamarhaber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, although I'm not sure why we bother with freeing everything correctly if we're gonna exit(1) anyway.

@ShooterIT
Copy link
Member Author

Thanks @itamarhaber May be to avoid warning of memory checking tools.
https://github.com/antirez/redis/pull/6114 is more meaningful. We have applied this optimization to our project and it has been stable for some time. I also will appreciate your correction if there is a problem.

@antirez
Copy link
Contributor

antirez commented Jan 10, 2020

@ShooterIT @itamarhaber I fixed it (with a different commit in order to have less code), because the same code path attempts to free memory, so it is correct to do so I guess even if we exit() later. Thanks.

antirez added a commit that referenced this pull request Jan 10, 2020
We exit later, so no bug fixed, but it is more correct.

See #6054, thanks to @ShooterIT for finding the issue.
antirez added a commit that referenced this pull request Jan 10, 2020
We exit later, so no bug fixed, but it is more correct.

See #6054, thanks to @ShooterIT for finding the issue.
@ShooterIT
Copy link
Member Author

ShooterIT commented Jan 10, 2020

Yes. That is more elegant @antirez
And I think aeDeleteEventLoop should be fixed in https://github.com/antirez/redis/pull/6189
This can be a very useful function in other project. I find leaking memory in valgrind report when I develop my toy projects using redis eventloop library.

@ShooterIT
Copy link
Member Author

ShooterIT commented Jan 10, 2020

There is a problem, and I leave a comment in aof.c. I will feel sorry if there will be some problems because my pr point is to make the code more correct.

@antirez
Copy link
Contributor

antirez commented Jan 13, 2020

@ShooterIT you are right, thank you! Fixing.

antirez added a commit that referenced this pull request Jan 13, 2020
@antirez
Copy link
Contributor

antirez commented Jan 13, 2020

@ShooterIT we ok after baa88a1?

@ShooterIT
Copy link
Member Author

I think it's ok, now @antirez

@antirez
Copy link
Contributor

antirez commented Jan 15, 2020

Thank you @ShooterIT

@antirez antirez closed this Jan 15, 2020
@ShooterIT ShooterIT deleted the aof-fmterr branch January 15, 2020 23:30
antirez added a commit that referenced this pull request Feb 4, 2020
JackieXie168 pushed a commit to JackieXie168/redis that referenced this pull request Feb 20, 2020
We exit later, so no bug fixed, but it is more correct.

See redis#6054, thanks to @ShooterIT for finding the issue.
JackieXie168 pushed a commit to JackieXie168/redis that referenced this pull request Feb 20, 2020
antirez added a commit that referenced this pull request Mar 5, 2020
We exit later, so no bug fixed, but it is more correct.

See #6054, thanks to @ShooterIT for finding the issue.
antirez added a commit that referenced this pull request Mar 5, 2020
kasiawasiuta pushed a commit to kasiawasiuta/redis that referenced this pull request Mar 11, 2020
We exit later, so no bug fixed, but it is more correct.

See redis#6054, thanks to @ShooterIT for finding the issue.
kasiawasiuta pushed a commit to kasiawasiuta/redis that referenced this pull request Mar 11, 2020
jschmieg pushed a commit to jschmieg/redis that referenced this pull request Mar 23, 2020
jschmieg pushed a commit to jschmieg/redis that referenced this pull request Mar 24, 2020
jschmieg pushed a commit to pmem/redis that referenced this pull request Mar 24, 2020
jschmieg pushed a commit to pmem/redis that referenced this pull request Apr 29, 2020
pulllock pushed a commit to pulllock/redis that referenced this pull request Jun 28, 2023
We exit later, so no bug fixed, but it is more correct.

See redis#6054, thanks to @ShooterIT for finding the issue.
pulllock pushed a commit to pulllock/redis that referenced this pull request Jun 28, 2023
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

Successfully merging this pull request may close these issues.

3 participants