Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=setup.git;a=commitdiff;h=8d5cdf9a557cd623d67a3ed35bfacf5bc1ed2c74

commit 8d5cdf9a557cd623d67a3ed35bfacf5bc1ed2c74
Author: Priyank <priy...@frugalware.org>
Date:   Sun Jun 14 13:41:53 2009 +0530

mountdev(): Fix memory leaks

diff --git a/src/plugins/formatdisk.c b/src/plugins/formatdisk.c
index da7e961..a16e92c 100644
--- a/src/plugins/formatdisk.c
+++ b/src/plugins/formatdisk.c
@@ -429,6 +429,7 @@ char *findmount(char *dev, int mode)
int mountdev(char *dev, char *mountpoint, GList **config)
{
char *type=NULL;
+       char *tmp=NULL;
FILE* fp;

// open fstab
@@ -439,12 +440,19 @@ int mountdev(char *dev, char *mountpoint, GList **config)
}

// mount
-       makepath(g_strdup_printf("%s/%s", TARGETDIR, mountpoint));
+       tmp = g_strdup_printf("%s/%s", TARGETDIR, mountpoint);
+       makepath(tmp);
+       FREE(tmp);
+
umount_if_needed(mountpoint);
-       fw_system(g_strdup_printf("mount %s %s/%s",
-               dev, TARGETDIR, mountpoint));
+       tmp = g_strdup_printf("mount %s %s/%s",
+                       dev, TARGETDIR, mountpoint);
+       fw_system(tmp);
+       FREE(tmp);
// unlink a possible stale lockfile
-       unlink(g_strdup_printf("%s/%s/tmp/pacman-g2.lck", TARGETDIR, 
mountpoint));
+       tmp = g_strdup_printf("%s/%s/tmp/pacman-g2.lck", TARGETDIR, mountpoint);
+       unlink(tmp);
+       FREE(tmp);

// make fstab entry
type = findmount(dev, 0);
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to