fix a mem leak when unknow type in decodeStart()
git-svn-id: https://svn.musicpd.org/mpd/trunk@1063 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
c51ad71efa
commit
3a5a75cf87
@ -238,9 +238,9 @@ void decodeStart(PlayerControl * pc, OutputBuffer * cb, DecoderControl * dc) {
|
|||||||
0 == strcmp(inStream.mime, "audio/mpeg")))
|
0 == strcmp(inStream.mime, "audio/mpeg")))
|
||||||
{
|
{
|
||||||
ret = mp3_decode(cb,dc,&inStream);
|
ret = mp3_decode(cb,dc,&inStream);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else ret = DECODE_ERROR_UNKTYPE;
|
else ret = DECODE_ERROR_UNKTYPE;
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
case DECODE_TYPE_FILE:
|
case DECODE_TYPE_FILE:
|
||||||
#ifdef HAVE_MAD
|
#ifdef HAVE_MAD
|
||||||
@ -285,10 +285,11 @@ void decodeStart(PlayerControl * pc, OutputBuffer * cb, DecoderControl * dc) {
|
|||||||
default:
|
default:
|
||||||
ret = DECODE_ERROR_UNKTYPE;
|
ret = DECODE_ERROR_UNKTYPE;
|
||||||
}
|
}
|
||||||
if(ret<0) {
|
if(ret<0 || ret == DECODE_ERROR_UNKTYPE) {
|
||||||
strncpy(pc->erroredFile, dc->file, MAXPATHLEN);
|
strncpy(pc->erroredFile, dc->file, MAXPATHLEN);
|
||||||
pc->erroredFile[MAXPATHLEN] = '\0';
|
pc->erroredFile[MAXPATHLEN] = '\0';
|
||||||
if(ret != DECODE_ERROR_UNKTYPE) dc->error = DECODE_ERROR_FILE;
|
if(ret != DECODE_ERROR_UNKTYPE) dc->error = DECODE_ERROR_FILE;
|
||||||
|
else closeInputStream(&inStream);
|
||||||
dc->start = 0;
|
dc->start = 0;
|
||||||
dc->stop = 0;
|
dc->stop = 0;
|
||||||
dc->state = DECODE_STATE_STOP;
|
dc->state = DECODE_STATE_STOP;
|
||||||
|
@ -34,8 +34,8 @@
|
|||||||
#define DECODE_STATE_DECODE 1
|
#define DECODE_STATE_DECODE 1
|
||||||
|
|
||||||
#define DECODE_ERROR_NOERROR 0
|
#define DECODE_ERROR_NOERROR 0
|
||||||
#define DECODE_ERROR_UNKTYPE -10
|
#define DECODE_ERROR_UNKTYPE 10
|
||||||
#define DECODE_ERROR_FILE -20
|
#define DECODE_ERROR_FILE 20
|
||||||
|
|
||||||
#define DECODE_SUFFIX_MP3 1
|
#define DECODE_SUFFIX_MP3 1
|
||||||
#define DECODE_SUFFIX_OGG 2
|
#define DECODE_SUFFIX_OGG 2
|
||||||
|
Loading…
Reference in New Issue
Block a user