Skip to content

libglusterfs: fix memory leak in gf_set_volfile_server_common#4661

Open
YifanZhang-311 wants to merge 1 commit intogluster:develfrom
YifanZhang-311:fix/memory-leak-in-gf_set_volfile_server_common
Open

libglusterfs: fix memory leak in gf_set_volfile_server_common#4661
YifanZhang-311 wants to merge 1 commit intogluster:develfrom
YifanZhang-311:fix/memory-leak-in-gf_set_volfile_server_common

Conversation

@YifanZhang-311
Copy link

Problem:
When gf_set_volfile_server_common() is called with a duplicate volfile server configuration, the function detects the duplicate and returns success (ret = 0). However, the newly allocated memory for server struct (server->volfile_server, server->transport, and server itself) is not freed before returning, causing a memory leak.

Solution:
Add GF_FREE() calls to release the allocated memory before returning on duplicate detection path.

Problem:
When gf_set_volfile_server_common() is called with a duplicate volfile
server configuration, the function detects the duplicate and returns
success (ret = 0). However, the newly allocated memory for server struct
(server->volfile_server, server->transport, and server itself) is not
freed before returning, causing a memory leak.

Solution:
Add GF_FREE() calls to release the allocated memory before returning
on duplicate detection path.
@YifanZhang-311
Copy link
Author

Hi @pranithk , could you please review this PR when you have time?
Thanks!

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.

1 participant