Mercurial > audlegacy-plugins
comparison 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 |
comparison
equal
deleted
inserted
replaced
2266:5395c85a8724 | 2267:2e961ce4bfe8 |
---|---|
743 { | 743 { |
744 FILE *fd; | 744 FILE *fd; |
745 char buf[PATH_MAX], *cache = NULL, *ptr1, *ptr2; | 745 char buf[PATH_MAX], *cache = NULL, *ptr1, *ptr2; |
746 int cachesize, written, i = 0; | 746 int cachesize, written, i = 0; |
747 item_t *item; | 747 item_t *item; |
748 gchar* config_datadir; | |
748 | 749 |
749 cachesize = written = 0; | 750 cachesize = written = 0; |
750 | 751 |
751 g_snprintf(buf, sizeof(buf), "%s/gerpokqueue.txt", audacious_get_localdir()); | 752 config_datadir = audacious_get_localdir(); |
753 g_snprintf(buf, sizeof(buf), "%s/gerpokqueue.txt", config_datadir); | |
754 g_free(config_datadir); | |
752 | 755 |
753 if (!(fd = fopen(buf, "r"))) | 756 if (!(fd = fopen(buf, "r"))) |
754 return; | 757 return; |
755 pdebug(fmt_vastr("Opening %s", buf), DEBUG); | 758 pdebug(fmt_vastr("Opening %s", buf), DEBUG); |
756 while(!feof(fd)) | 759 while(!feof(fd)) |
821 static void dump_queue(void) | 824 static void dump_queue(void) |
822 { | 825 { |
823 FILE *fd; | 826 FILE *fd; |
824 item_t *item; | 827 item_t *item; |
825 char *home, buf[PATH_MAX]; | 828 char *home, buf[PATH_MAX]; |
829 gchar* config_datadir; | |
826 | 830 |
827 /*pdebug("Entering dump_queue();", DEBUG);*/ | 831 /*pdebug("Entering dump_queue();", DEBUG);*/ |
828 | 832 |
829 if (!(home = getenv("HOME"))) | 833 if (!(home = getenv("HOME"))) |
830 { | 834 { |
831 pdebug("No HOME directory found. Cannot dump queue.", DEBUG); | 835 pdebug("No HOME directory found. Cannot dump queue.", DEBUG); |
832 return; | 836 return; |
833 } | 837 } |
834 | 838 |
835 g_snprintf(buf, sizeof(buf), "%s/gerpokqueue.txt", audacious_get_localdir()); | 839 config_datadir = audacious_get_localdir(); |
840 g_snprintf(buf, sizeof(buf), "%s/gerpokqueue.txt", config_datadir); | |
841 g_free(config_datadir); | |
836 | 842 |
837 if (!(fd = fopen(buf, "w"))) | 843 if (!(fd = fopen(buf, "w"))) |
838 { | 844 { |
839 pdebug(fmt_vastr("Failure opening %s", buf), DEBUG); | 845 pdebug(fmt_vastr("Failure opening %s", buf), DEBUG); |
840 return; | 846 return; |