summary refs log tree commit diff stats
path: root/plugins/mpcinfo/theme.c
diff options
context:
space:
mode:
authorIgor <f2404@yandex.ru>2016-10-11 13:34:29 +0300
committerPatrick Griffis <tingping@tingping.se>2016-10-11 09:55:29 -0400
commitf38261f666a2e41bbd189940ca7d419b3e726376 (patch)
tree4129ce87ce3e2011b6b089d2f33ae8e5e8928430 /plugins/mpcinfo/theme.c
parent2a81b98e7bcad05bf54d9c423f68df6492ae4326 (diff)
mpcinfo: Fix memory leaks
Closes #1838
Diffstat (limited to 'plugins/mpcinfo/theme.c')
-rw-r--r--plugins/mpcinfo/theme.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/plugins/mpcinfo/theme.c b/plugins/mpcinfo/theme.c
index 3d8a7a0e..7b92ec08 100644
--- a/plugins/mpcinfo/theme.c
+++ b/plugins/mpcinfo/theme.c
@@ -91,13 +91,15 @@ struct theme themeAdd(struct theme data, char *info){
 }
 
 void loadThemes(){
-    char *hDir, *hFile, *line, *val;
+    char *hDir, *hFile, *line, *lineCap, *val;
 	FILE *f;
 	hexchat_print(ph,"loading themes\n");
     hDir=(char*)calloc(1024,sizeof(char));
     strcpy(hDir,hexchat_get_info(ph,"configdir"));
     hFile=str3cat(hDir,"\\","mpcInfo.theme.txt");
     f = fopen(hFile,"r");
+    free(hDir);
+    free(hFile);
     if(f==NULL)
 	{
 		hexchat_print(ph,"no theme in homedir, checking global theme");
@@ -120,10 +122,12 @@ void loadThemes(){
 			val=split(line,'=');
 			printf("line: %s\n",line);
 			printf("val: %s\n",val);
-			if (strcmp(toUpper(line),"OFF_LINE")==0) notRunTheme=themeAdd(notRunTheme,val);
-			if (strcmp(toUpper(line),"TITLE_LINE")==0) titleTheme=themeAdd(titleTheme,val);
-			if (strcmp(toUpper(line),"MP3_LINE")==0) mp3Theme=themeAdd(mp3Theme,val);
-			if (strcmp(toUpper(line),"OGG_LINE")==0) mp3Theme=themeAdd(oggTheme,val);
+			lineCap=toUpper(line);
+			if (strcmp(lineCap,"OFF_LINE")==0) notRunTheme=themeAdd(notRunTheme,val);
+			if (strcmp(lineCap,"TITLE_LINE")==0) titleTheme=themeAdd(titleTheme,val);
+			if (strcmp(lineCap,"MP3_LINE")==0) mp3Theme=themeAdd(mp3Theme,val);
+			if (strcmp(lineCap,"OGG_LINE")==0) mp3Theme=themeAdd(oggTheme,val);
+			free(lineCap);
 		}
 		fclose(f);
 		hexchat_print(ph, "theme loaded successfull\n");