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

[BUG]There is a memory leak defect at line 3615 in the file /redis/src/redis-cli.c. #13259

Open
LuMingYinDetect opened this issue May 11, 2024 · 2 comments

Comments

@LuMingYinDetect
Copy link

Describe the bug

At line 3540 in the file /redis/src/redis-cli.c, a pointer variable named argv2 is defined. This pointer variable is assigned a dynamically allocated memory block using the zmalloc function at line 3580. The program uses this pointer in the issueCommand function at line 3595. When the program returns at line 3615, the dynamically allocated memory pointed to by argv2 is not freed, leading to a memory leak defect, as illustrated in the diagram below:
https://github.com/LuMingYinDetect/redis_defects/blob/main/redis_2.png

To reproduce

The detection tool I'm using is the Clang Static Analyzer, which employs static analysis techniques. The tool's defect reports provide the path that triggers the defect. Based on the aforementioned path, the defect can be reproduced.

Expected behavior

If the defect is confirmed, it is advisable to address it by making necessary fixes.

@sundb
Copy link
Collaborator

sundb commented May 11, 2024

@LuMingYinDetect thanks, let's fix it in #13258 together.

@LuMingYinDetect
Copy link
Author

@LuMingYinDetect thanks, let's fix it in #13258 together.

Thank you for your prompt response! I have fixed the issue and synced it to the pull request.

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

2 participants