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

commit 3017855a8cd9ba0faa5f0f124938234d7e45969e
Author: Priyank <priy...@frugalware.org>
Date:   Sat Jun 13 13:53:15 2009 +0530

Fix memleaks
* strings returned by g_strdup_printf() should always be freed

diff --git a/src/plugins/select.c b/src/plugins/select.c
index dfb3c1e..aca5bba 100644
--- a/src/plugins/select.c
+++ b/src/plugins/select.c
@@ -323,13 +323,21 @@ int prepare_pkgdb(char *repo, GList **config, GList 
**syncs)
if(stat(pkgdb, &sbuf) || !S_ISDIR(sbuf.st_mode))
{
// pacman can't lock & log without these
-               makepath(g_strdup_printf("%s/tmp", TARGETDIR));
-               makepath(g_strdup_printf("%s/var/log", TARGETDIR));
+               char *temp = NULL;
+
+               temp = g_strdup_printf("%s/tmp", TARGETDIR);
+               makepath(temp);
+               g_free(temp);
+               temp = g_strdup_printf("%s/var/log", TARGETDIR);
+               makepath(temp);
+               g_free(temp);
if((char*)data_get(*config, "netinstall")==NULL)
{
makepath(pkgdb);
// TODO: use libarchive for this
-                       fw_system(g_strdup_printf("tar xjf %s/%s.fdb -C %s", 
pacbindir, repo, pkgdb));
+                       temp = g_strdup_printf("tar xjf %s/%s.fdb -C %s", 
pacbindir, repo, pkgdb);
+                       fw_system(temp);
+                       g_free(temp);
if ((fp = fopen("/etc/pacman-g2.conf", "w")) == NULL)
{
LOG("could not open output file '/etc/pacman-g2.conf' for writing: %s", 
strerror(errno));
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to