mesh: Fix memory leaks
authorSteve Grubb <sgrubb@redhat.com>
Fri, 14 May 2021 13:58:07 +0000 (09:58 -0400)
committerAyush Garg <ayush.garg@samsung.com>
Fri, 11 Mar 2022 13:38:35 +0000 (19:08 +0530)
The dir variable needs to be closed before leaving.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
mesh/rpl.c

index f9b1ae1..904cef7 100644 (file)
@@ -146,8 +146,10 @@ static void get_entries(const char *iv_path, struct l_queue *rpl_list)
                return;
 
        iv_txt = basename(iv_path);
-       if (sscanf(iv_txt, "%08x", &iv_index) != 1)
+       if (sscanf(iv_txt, "%08x", &iv_index) != 1) {
+               closedir(dir);
                return;
+       }
 
        memset(seq_txt, 0, sizeof(seq_txt));