[hackers] [ubase] Free minfo table || sin

From: <git_AT_suckless.org>
Date: Sat, 25 Jan 2014 23:34:58 +0100

commit 5b0d03acc6af1e07f5598c82f2bc735b9889cfaf
Author: sin <sin_AT_2f30.org>
Date: Sat Jan 25 22:34:05 2014 +0000

    Free minfo table

diff --git a/df.c b/df.c
index 6118fe2..d886b2f 100644
--- a/df.c
+++ b/df.c
_AT_@ -35,8 +35,11 @@ main(int argc, char *argv[])
         if (!siz)
                 eprintf("grabmntinfo:");
 
- for (i = 0; i < siz; i++)
+ for (i = 0; i < siz; i++) {
                 mnt_show(minfo[i].fsname, minfo[i].mntdir);
+ free(minfo[i].fsname);
+ free(minfo[i].mntdir);
+ }
         free(minfo);
 
         return EXIT_SUCCESS;
diff --git a/grabmntinfo.h b/grabmntinfo.h
index 1239cef..a13be67 100644
--- a/grabmntinfo.h
+++ b/grabmntinfo.h
_AT_@ -1,8 +1,8 @@
 /* See LICENSE file for copyright and license details. */
 
 struct mntinfo {
- const char *fsname;
- const char *mntdir;
+ char *fsname;
+ char *mntdir;
 };
 
 int grabmntinfo(struct mntinfo **minfo);
diff --git a/mount.c b/mount.c
index 9199b25..cd24480 100644
--- a/mount.c
+++ b/mount.c
_AT_@ -149,6 +149,10 @@ main(int argc, char *argv[])
         if (mount(source, target, types, flags, data) < 0)
                 eprintf("mount:");
 
+ for (i = 0; i < siz; i++) {
+ free(minfo[i].fsname);
+ free(minfo[i].mntdir);
+ }
         free(minfo);
 
         opt = opthead;
diff --git a/mountpoint.c b/mountpoint.c
index 2815c35..0521138 100644
--- a/mountpoint.c
+++ b/mountpoint.c
_AT_@ -72,6 +72,11 @@ main(int argc, char *argv[])
                     st1.st_ino == st2.st_ino)
                         break;
         }
+
+ for (i = 0; i < siz; i++) {
+ free(minfo[i].fsname);
+ free(minfo[i].mntdir);
+ }
         free(minfo);
 
         if (i == siz)
Received on Sat Jan 25 2014 - 23:34:58 CET

This archive was generated by hypermail 2.3.0 : Sat Jan 25 2014 - 23:36:11 CET