summary refs log tree commit diff stats
path: root/plugins/mpcinfo
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mpcinfo')
-rw-r--r--plugins/mpcinfo/mp3Info.c10
-rw-r--r--plugins/mpcinfo/oggInfo.c1
-rw-r--r--plugins/mpcinfo/theme.c14
3 files changed, 17 insertions, 8 deletions
diff --git a/plugins/mpcinfo/mp3Info.c b/plugins/mpcinfo/mp3Info.c
index 1af29e45..240b07a6 100644
--- a/plugins/mpcinfo/mp3Info.c
+++ b/plugins/mpcinfo/mp3Info.c
@@ -122,7 +122,6 @@ struct tagInfo readID3V1(char *file){
 	char *tag;
 	char *id;
 	char *tmp;
-	tag = (char*) malloc(sizeof(char)*129);
 	ret.artist=NULL;
 	f=fopen(file,"rb");
 	if (f==NULL){
@@ -133,18 +132,21 @@ struct tagInfo readID3V1(char *file){
 	//int offset=getSize(file)-128;
 	res=fseek(f,-128,SEEK_END);
 	if (res!=0) {printf("seek failed\n");fclose(f);return ret;}
+	tag = (char*) malloc(sizeof(char)*129);
 	//long int pos=ftell(f);
 	//printf("position= %li\n",pos);
 	for (i=0;i<128;i++) {
 		c=fgetc(f);
-		if (c==EOF) {hexchat_printf(ph,"read ID3V1 failed\n");fclose(f);return ret;}
+		if (c==EOF) {hexchat_printf(ph,"read ID3V1 failed\n");fclose(f);free(tag);return ret;}
 		tag[i]=(char)c;
 	}
 	fclose(f);
 	//printf("tag readed: \n");
 	id=substring(tag,0,3);
 	//printf("header: %s\n",id);
-	if (strcmp(id,"TAG")!=0){hexchat_printf(ph,"no id3 v1 found\n");return ret;}
+	res=strcmp(id,"TAG");
+	free(id);
+	if (res!=0){hexchat_printf(ph,"no id3 v1 found\n");free(tag);return ret;}
 	ret.title=subString(tag,3,30,1);
 	ret.artist=subString(tag,33,30,1);
 	ret.album=subString(tag,63,30,1);
@@ -164,6 +166,8 @@ struct tagInfo readID3V1(char *file){
 	//hexchat_printf(ph, "tmp: \"%s\" -> %i",tmp,tmp[0]);
 	//hexchat_printf(ph,"genre \"%s\"",ret.genre);
 	//if (DEBUG==1) putlog("id3v1 extracted");
+	free(tmp);
+	free(tag);
 	return ret;
 }
 
diff --git a/plugins/mpcinfo/oggInfo.c b/plugins/mpcinfo/oggInfo.c
index e1191649..8ecf0f5b 100644
--- a/plugins/mpcinfo/oggInfo.c
+++ b/plugins/mpcinfo/oggInfo.c
@@ -104,6 +104,7 @@ struct tagInfo getOggHeader(char *file){
 		if (strcmp(name,"GENRE")==0) info.genre=val;
 		if (strcmp(name,"COMMENT")==0) info.comment=val;
 		pos+=4+tagLen;
+		free(name);
 	}
 	if (info.artist==NULL) info.artist="";
 	if (info.album==NULL) info.album ="";
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");