ubase

suckless linux base utils
git clone git://git.2f30.org/ubase
Log | Files | Refs | README | LICENSE

commit 5b0d03acc6af1e07f5598c82f2bc735b9889cfaf
parent 40408570740498f2d9efa1f9259065cef894dc86
Author: sin <sin@2f30.org>
Date:   Sat, 25 Jan 2014 22:34:05 +0000

Free minfo table

Diffstat:
Mdf.c | 5++++-
Mgrabmntinfo.h | 4++--
Mmount.c | 4++++
Mmountpoint.c | 5+++++
4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/df.c b/df.c @@ -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 @@ -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 @@ -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 @@ -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)