Commit 5d1df8e2 authored by J. Alexander Treuman's avatar J. Alexander Treuman

Fixing a whopping 4 memory leaks

git-svn-id: https://svn.musicpd.org/mpd/trunk@4371 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 8d630f30
...@@ -261,11 +261,16 @@ static void decodeStart(PlayerControl * pc, OutputBuffer * cb, DecoderControl * ...@@ -261,11 +261,16 @@ static void decodeStart(PlayerControl * pc, OutputBuffer * cb, DecoderControl *
InputStream inStream; InputStream inStream;
InputPlugin * plugin = NULL; InputPlugin * plugin = NULL;
char * path; char * path;
char * relativePath;
if(isRemoteUrl(pc->utf8url)) { if(isRemoteUrl(pc->utf8url)) {
path = utf8StrToLatin1Dup(pc->utf8url); path = utf8StrToLatin1Dup(pc->utf8url);
} }
else path = strdup(rmp2amp(utf8ToFsCharset(pc->utf8url))); else {
relativePath = utf8ToFsCharset(pc->utf8url);
path = strdup(rmp2amp(relativePath));
free(relativePath);
}
if(!path) { if(!path) {
dc->error = DECODE_ERROR_FILE; dc->error = DECODE_ERROR_FILE;
......
...@@ -111,7 +111,7 @@ int lsPlaylists(FILE * fp, char * utf8path) { ...@@ -111,7 +111,7 @@ int lsPlaylists(FILE * fp, char * utf8path) {
char s[MAXPATHLEN+1]; char s[MAXPATHLEN+1];
List * list = NULL; List * list = NULL;
ListNode * node = NULL; ListNode * node = NULL;
char * path = strdup(utf8ToFsCharset(utf8path)); char * path = utf8ToFsCharset(utf8path);
char * actualPath = rpp2app(path); char * actualPath = rpp2app(path);
int actlen = strlen(actualPath)+1; int actlen = strlen(actualPath)+1;
int maxlen = MAXPATHLEN-actlen; int maxlen = MAXPATHLEN-actlen;
......
...@@ -1310,7 +1310,7 @@ int savePlaylist(FILE * fp, char * utf8file) { ...@@ -1310,7 +1310,7 @@ int savePlaylist(FILE * fp, char * utf8file) {
return -1; return -1;
} }
file = strdup(utf8ToFsCharset(utf8file)); file = utf8ToFsCharset(utf8file);
rfile = malloc(strlen(file)+strlen(".")+ rfile = malloc(strlen(file)+strlen(".")+
strlen(PLAYLIST_FILE_SUFFIX)+1); strlen(PLAYLIST_FILE_SUFFIX)+1);
...@@ -1415,7 +1415,7 @@ static int PlaylistIterFunc(FILE * fp, char * utf8file, void (*IterFunc)(FILE *f ...@@ -1415,7 +1415,7 @@ static int PlaylistIterFunc(FILE * fp, char * utf8file, void (*IterFunc)(FILE *f
FILE * fileP; FILE * fileP;
char s[MAXPATHLEN+1]; char s[MAXPATHLEN+1];
int slength = 0; int slength = 0;
char * temp = strdup(utf8ToFsCharset(utf8file)); char * temp = utf8ToFsCharset(utf8file);
char * rfile = malloc(strlen(temp)+strlen(".")+ char * rfile = malloc(strlen(temp)+strlen(".")+
strlen(PLAYLIST_FILE_SUFFIX)+1); strlen(PLAYLIST_FILE_SUFFIX)+1);
char * actualFile; char * actualFile;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment