stream_cdda: fix incorrectly allocated option field

After commit 39e373aa8d ("options: allocate dynamic options with
talloc") dynamically allocated options must be allocated with talloc.
stream_cdda allocated a string used with the option machinery using
strdup(). Fix. Also silence a warning.
This commit is contained in:
Uoti Urpala 2011-07-30 04:03:47 +03:00
parent 85f0577cd9
commit a2d74a6b20
1 changed files with 5 additions and 3 deletions

View File

@ -27,6 +27,8 @@
#include <stdio.h>
#include <stdlib.h>
#include "talloc.h"
#include "stream.h"
#include "m_option.h"
#include "m_struct.h"
@ -302,9 +304,9 @@ static int open_cdda(stream_t *st,int m, void* opts, int* file_format) {
if(!p->device) {
if (cdrom_device)
p->device = strdup(cdrom_device);
p->device = talloc_strdup(NULL, cdrom_device);
else
p->device = strdup(DEFAULT_CDROM_DEVICE);
p->device = talloc_strdup(NULL, DEFAULT_CDROM_DEVICE);
}
#ifdef CONFIG_CDDB
@ -355,7 +357,7 @@ static int open_cdda(stream_t *st,int m, void* opts, int* file_format) {
}
cd_info = cd_info_new();
mp_tmsg(MSGT_OPEN,MSGL_INFO,"Found audio CD with %ld tracks.\n",cdda_tracks(cdd));
mp_tmsg(MSGT_OPEN,MSGL_INFO,"Found audio CD with %d tracks.\n", (int)cdda_tracks(cdd));
for(i=0;i<cdd->tracks;i++) {
char track_name[80];
long sec=cdda_track_firstsector(cdd,i+1);