diff src/scrobbler/gerpok.c @ 2267:2e961ce4bfe8

Fixes memory leaks that are visible during startup in scrobbler plugin (Bugzilla #26)
author Jussi Judin <jjudin+audacious@iki.fi>
date Tue, 25 Dec 2007 02:15:51 -0600
parents 0ea55fc6f220
children 166397a7efe1
line wrap: on
line diff
--- a/src/scrobbler/gerpok.c	Tue Dec 25 02:15:14 2007 -0600
+++ b/src/scrobbler/gerpok.c	Tue Dec 25 02:15:51 2007 -0600
@@ -745,10 +745,13 @@
 	char buf[PATH_MAX], *cache = NULL, *ptr1, *ptr2;
 	int cachesize, written, i = 0;
 	item_t *item;
+	gchar* config_datadir;
 
 	cachesize = written = 0;
 
-	g_snprintf(buf, sizeof(buf), "%s/gerpokqueue.txt", audacious_get_localdir());
+	config_datadir = audacious_get_localdir();
+	g_snprintf(buf, sizeof(buf), "%s/gerpokqueue.txt", config_datadir);
+	g_free(config_datadir);
 
 	if (!(fd = fopen(buf, "r")))
 		return;
@@ -823,6 +826,7 @@
 	FILE *fd;
 	item_t *item;
 	char *home, buf[PATH_MAX];
+	gchar* config_datadir;
 
 	/*pdebug("Entering dump_queue();", DEBUG);*/
 
@@ -832,7 +836,9 @@
 		return;
 	}
 
-	g_snprintf(buf, sizeof(buf), "%s/gerpokqueue.txt", audacious_get_localdir());
+	config_datadir = audacious_get_localdir();
+	g_snprintf(buf, sizeof(buf), "%s/gerpokqueue.txt", config_datadir);
+	g_free(config_datadir);
 
 	if (!(fd = fopen(buf, "w")))
 	{