gluster / glusterfs

Gluster Filesystem : Build your distributed storage in minutes
https://www.gluster.org
GNU General Public License v2.0
4.54k stars 1.07k forks source link

Handle leak in bit-rot-stub #4352

Open sminux opened 1 month ago

sminux commented 1 month ago

Description of problem: The handle 'fd_ctx->bad_object->dir' is created at syscall.c:149 by calling function 'sys_opendir' at bit-rot-stub.c:2690 https://github.com/gluster/glusterfs/blob/929d71b084e1e7f995d3a2884d16438108f6f621/xlators/features/bit-rot/src/stub/bit-rot-stub.c#L2690 and lost at bit-rot-stub.c:2698.

Do we need to add sys_closedir(fd_ctx->bad_object.dir); https://github.com/gluster/glusterfs/blob/929d71b084e1e7f995d3a2884d16438108f6f621/xlators/features/bit-rot/src/stub/bit-rot-stub.c#L2698

This is a svace static analyzer warning

The exact command to reproduce the issue:

The full output of the command that failed:

Expected results:

Mandatory info:

Additional info:

- Debian / 10.5: