]> git.tdb.fi Git - pmount-gui.git/commitdiff
Fix memory leaks
authorStas Cymbalov <dummyunit@gmail.com>
Mon, 3 Apr 2017 20:51:19 +0000 (23:51 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 16 Apr 2017 08:09:29 +0000 (11:09 +0300)
Free unused members of `nodes' array on early loop exit.
Free string array `fstab'.
Remove unused variable `mounted'.

main.c

diff --git a/main.c b/main.c
index 8f939e60696764d39be3e56558026a779a20d8c5..76632ab3d50b056063beea31e4a9061c7ea9609e 100644 (file)
--- a/main.c
+++ b/main.c
@@ -542,7 +542,6 @@ Device *get_devices(void)
        char **nodes = NULL;
        Device *devices = NULL;
        int n_devices = 0;
-       char **mounted = NULL;
        char **fstab = NULL;
        int i;
 
@@ -561,6 +560,7 @@ Device *get_devices(void)
                {
                        if(verbosity>=2)
                                printf("  No properties\n");
+                       free(nodes[i]);
                        continue;
                }
 
@@ -626,7 +626,7 @@ Device *get_devices(void)
        }
 
        free(nodes);
-       free_string_array(mounted);
+       free_string_array(fstab);
 
        if(devices)
        {