Whamcloud - gitweb
LU-16614 lfs: Fix memory leak 96/50196/2
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Fri, 3 Mar 2023 09:10:01 +0000 (14:40 +0530)
committerOleg Drokin <green@whamcloud.com>
Mon, 13 Mar 2023 06:09:35 +0000 (06:09 +0000)
Fix memory leak while running "lfs check all"

Before patch:
=============
$ valgrind --leak-check=full lfs check all
<snip>
==93768== LEAK SUMMARY:
==93768==    definitely lost: 56 bytes in 2 blocks
==93768==    indirectly lost: 282 bytes in 5 blocks
==93768==      possibly lost: 0 bytes in 0 blocks
==93768==    still reachable: 0 bytes in 0 blocks
==93768==         suppressed: 0 bytes in 0 blocks
<snip>

After patch:
=============
$ valgrind --leak-check=full lfs check all
<snip>
 HEAP SUMMARY:
   in use at exit: 0 bytes in 0 blocks
 total heap usage: 98 allocs, 98 frees, 294,999 bytes allocated
 All heap blocks were freed -- no leaks are possible
<snip>

Test-Parameters: trivial
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: Ib39d1f89a9c6937668f2a7d515606c7df86ac1df
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50196
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/utils/liblustreapi.c

index b2d4f83..80c062b 100644 (file)
@@ -6393,6 +6393,7 @@ int llapi_target_iterate(int type_num, char **obd_type,
                        fclose(fp);
                        fp = NULL;
                }
+               cfs_free_param_data(&param);
        }
 free_path:
        if (fp)