summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/audio_out/audio_alsa_out.c54
-rw-r--r--src/audio_out/audio_arts_out.c11
-rw-r--r--src/audio_out/audio_coreaudio_out.c4
-rw-r--r--src/audio_out/audio_directx2_out.c7
-rwxr-xr-xsrc/audio_out/audio_directx_out.c6
-rw-r--r--src/audio_out/audio_esd_out.c11
-rw-r--r--src/audio_out/audio_file_out.c6
-rw-r--r--src/audio_out/audio_irixal_out.c4
-rw-r--r--src/audio_out/audio_none_out.c6
-rw-r--r--src/audio_out/audio_oss_out.c6
-rw-r--r--src/audio_out/audio_polyp_out.c8
-rw-r--r--src/audio_out/audio_pulse_out.c8
-rw-r--r--src/audio_out/audio_sun_out.c6
13 files changed, 90 insertions, 47 deletions
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c
index 2893b2c40..f2a5ffe96 100644
--- a/src/audio_out/audio_alsa_out.c
+++ b/src/audio_out/audio_alsa_out.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2004 the xine project
+ * Copyright (C) 2000-2006 the xine project
*
* This file is part of xine, a free video player.
*
@@ -26,7 +26,7 @@
* (c) 2001 James Courtier-Dutton <James@superbug.demon.co.uk>
*
*
- * $Id: audio_alsa_out.c,v 1.162 2006/07/11 03:11:51 dgp85 Exp $
+ * $Id: audio_alsa_out.c,v 1.163 2006/07/16 16:18:09 dsalt Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -274,36 +274,13 @@ static void
const char *function, int err, const char *fmt, ...) {
#ifdef DEBUG
va_list args;
- char *buf;
- int n, size = 100;
-
- printf("%s:%s:%d entered\n", __FILE__, __FUNCTION__, __LINE__ );
- if(!(buf = xine_xmalloc(size)))
- return;
-
- while(1) {
-
- va_start(args, fmt);
- n = vsnprintf(buf, size, fmt, args);
- va_end(args);
-
- if(n > -1 && n < size)
- break;
-
- if(n > -1)
- size = n + 1;
- else
- size *= 2;
-
- if((buf = realloc(buf, size)) == NULL)
- return;
- }
-
-
- printf("%s: %s() %s.\n", file, function, buf);
+ char *buf = NULL;
- if(buf)
- free(buf);
+ va_start(args, fmt);
+ vasprintf(buf, fmt, args);
+ va_end(args);
+ printf("%s: %s() %s.\n", file, function, buf);
+ free(buf);
#endif
}
@@ -1348,6 +1325,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
int speakers;
this = (alsa_driver_t *) xine_xmalloc (sizeof (alsa_driver_t));
+ if (!this)
+ return NULL;
this->class = class;
@@ -1432,6 +1411,7 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
_("snd_pcm_open() failed:%d:%s\n"), err, snd_strerror(err));
xine_log (this->class->xine, XINE_LOG_MSG,
_(">>> Check if another program already uses PCM <<<\n"));
+ free(this);
return NULL;
}
@@ -1442,6 +1422,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
if (err < 0) {
xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
"audio_alsa_out: broken configuration for this PCM: no configurations available\n");
+ snd_pcm_close(this->audio_fd);
+ free(this);
return NULL;
}
err = snd_pcm_hw_params_set_access(this->audio_fd, params,
@@ -1449,6 +1431,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
if (err < 0) {
xprintf (this->class->xine, XINE_VERBOSITY_DEBUG,
"audio_alsa_out: access type not available");
+ snd_pcm_close(this->audio_fd);
+ free(this);
return NULL;
}
@@ -1582,6 +1566,12 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
"information on alsa devices."),
10, NULL,
NULL);
+ if (!this->mixer.name) {
+ if (this->audio_fd)
+ snd_pcm_close (this->audio_fd);
+ free(this);
+ return NULL;
+ }
pthread_mutex_init(&this->mixer.mutex, NULL);
ao_alsa_mixer_init(&this->ao_driver);
@@ -1660,6 +1650,8 @@ static void *init_class (xine_t *xine, void *data) {
alsa_class_t *this;
this = (alsa_class_t *) xine_xmalloc (sizeof (alsa_class_t));
+ if (!this)
+ return NULL;
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;
diff --git a/src/audio_out/audio_arts_out.c b/src/audio_out/audio_arts_out.c
index f7fd7c379..f38575aff 100644
--- a/src/audio_out/audio_arts_out.c
+++ b/src/audio_out/audio_arts_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_arts_out.c,v 1.31 2006/07/10 22:08:12 dgp85 Exp $
+ * $Id: audio_arts_out.c,v 1.32 2006/07/16 16:18:09 dsalt Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -306,6 +306,10 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
lprintf ("audio_arts_out: open_plugin called\n");
this = (arts_driver_t *) xine_xmalloc (sizeof (arts_driver_t));
+ if (!this)
+ return NULL;
+
+ this->xine = class->xine;
if (class->inited == 0) {
rc = arts_init();
@@ -328,8 +332,6 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
this->mixer.mute = 0;
this->mixer.vol_scale = 60;
this->mixer.v_mixer = 0;
-
- this->xine = class->xine;
/*
* set capabilities
*/
@@ -385,6 +387,9 @@ static void *init_class (xine_t *xine, void *data) {
lprintf ("audio_arts_out: init class\n");
this = (arts_class_t *) xine_xmalloc (sizeof (arts_class_t));
+ if (!this)
+ return NULL;
+
this->inited = 0;
this->driver_class.open_plugin = open_plugin;
diff --git a/src/audio_out/audio_coreaudio_out.c b/src/audio_out/audio_coreaudio_out.c
index ab3b022c7..80cab6d71 100644
--- a/src/audio_out/audio_coreaudio_out.c
+++ b/src/audio_out/audio_coreaudio_out.c
@@ -529,6 +529,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen,
lprintf ("open_plugin called\n");
this = (coreaudio_driver_t *) xine_xmalloc (sizeof (coreaudio_driver_t));
+ if (!this)
+ return NULL;
this->xine = class->xine;
this->capabilities = AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO;
@@ -579,6 +581,8 @@ static void *init_class (xine_t *xine, void *data) {
lprintf ("init class\n");
this = (coreaudio_class_t *) xine_xmalloc (sizeof (coreaudio_class_t));
+ if (!this)
+ return NULL;
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;
diff --git a/src/audio_out/audio_directx2_out.c b/src/audio_out/audio_directx2_out.c
index 45cd5f31c..aff4412ec 100644
--- a/src/audio_out/audio_directx2_out.c
+++ b/src/audio_out/audio_directx2_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_directx2_out.c,v 1.8 2006/07/10 22:08:12 dgp85 Exp $
+ * $Id: audio_directx2_out.c,v 1.9 2006/07/16 16:18:09 dsalt Exp $
*
*
* xine audio output plugin using DirectX
@@ -961,6 +961,9 @@ static ao_driver_t *open_plugin(audio_driver_class_t *class_gen, const void *dat
lprintf("open plugin called\n");
this = (dx2_driver_t *)xine_xmalloc(sizeof(dx2_driver_t));
+ if (!this)
+ return NULL;
+
this->class = class;
this->ao_driver.get_capabilities = ao_dx2_get_capabilities;
@@ -1012,6 +1015,8 @@ static void *init_class(xine_t *xine, void *data) {
lprintf("init class\n");
this = (dx2_class_t *)xine_xmalloc(sizeof(dx2_class_t));
+ if (!this)
+ return NULL;
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;
diff --git a/src/audio_out/audio_directx_out.c b/src/audio_out/audio_directx_out.c
index 71bcd7604..54d4d99fd 100755
--- a/src/audio_out/audio_directx_out.c
+++ b/src/audio_out/audio_directx_out.c
@@ -20,7 +20,7 @@
* audio_directx_out.c, direct sound audio output plugin for xine
* by Matthew Grooms <elon@altavista.com>
*
- * $Id: audio_directx_out.c,v 1.15 2006/07/10 22:08:12 dgp85 Exp $
+ * $Id: audio_directx_out.c,v 1.16 2006/07/16 16:18:09 dsalt Exp $
*/
/*
@@ -793,6 +793,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
ao_directx_t *ao_directx;
ao_directx = ( ao_directx_t * ) xine_xmalloc( sizeof( ao_directx_t ) );
+ if (!ao_directx)
+ return NULL;
lprintf("open_plugin(%08x, %08x) Enter\n", (unsigned long)class_gen, (unsigned long)data);
lprintf("open_plugin: ao_directx=%08x\n", (unsigned long)ao_directx);
@@ -842,6 +844,8 @@ static void *init_class (xine_t *xine, void *data) {
* from this point on, nothing should go wrong anymore
*/
audiox = (audiox_class_t *) xine_xmalloc (sizeof (audiox_class_t));
+ if (!ao_directx)
+ return NULL;
audiox->driver_class.open_plugin = open_plugin;
audiox->driver_class.get_identifier = get_identifier;
diff --git a/src/audio_out/audio_esd_out.c b/src/audio_out/audio_esd_out.c
index c05e3fae0..20e77b75d 100644
--- a/src/audio_out/audio_esd_out.c
+++ b/src/audio_out/audio_esd_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_esd_out.c,v 1.34 2006/07/10 22:08:12 dgp85 Exp $
+ * $Id: audio_esd_out.c,v 1.35 2006/07/16 16:18:09 dsalt Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -523,10 +523,15 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen,
esd_close(audio_fd);
-
this = (esd_driver_t *) xine_xmalloc (sizeof (esd_driver_t));
+ if (!this)
+ return NULL;
this->xine = class->xine;
this->pname = strdup("xine esd audio output plugin");
+ if (!this->pname) {
+ free (this);
+ return NULL;
+ }
this->output_sample_rate = 0;
this->server_sample_rate = server_sample_rate;
this->audio_fd = -1;
@@ -581,6 +586,8 @@ static void *init_class (xine_t *xine, void *data) {
esd_class_t *this;
this = (esd_class_t *) xine_xmalloc (sizeof (esd_class_t));
+ if (!this)
+ return NULL;
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;
diff --git a/src/audio_out/audio_file_out.c b/src/audio_out/audio_file_out.c
index 32ab2e0ae..e741523b2 100644
--- a/src/audio_out/audio_file_out.c
+++ b/src/audio_out/audio_file_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_file_out.c,v 1.7 2006/07/10 22:08:12 dgp85 Exp $
+ * $Id: audio_file_out.c,v 1.8 2006/07/16 16:18:09 dsalt Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -326,6 +326,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen,
lprintf ("open_plugin called\n");
this = (file_driver_t *) xine_xmalloc (sizeof (file_driver_t));
+ if (!this)
+ return NULL;
this->xine = class->xine;
this->capabilities = AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO;
@@ -376,6 +378,8 @@ static void *init_class (xine_t *xine, void *data) {
lprintf ("init class\n");
this = (file_class_t *) xine_xmalloc (sizeof (file_class_t));
+ if (!this)
+ return NULL;
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;
diff --git a/src/audio_out/audio_irixal_out.c b/src/audio_out/audio_irixal_out.c
index 9857a9867..04c338d24 100644
--- a/src/audio_out/audio_irixal_out.c
+++ b/src/audio_out/audio_irixal_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_irixal_out.c,v 1.15 2006/07/10 22:08:12 dgp85 Exp $
+ * $Id: audio_irixal_out.c,v 1.16 2006/07/16 16:18:09 dsalt Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -348,6 +348,8 @@ static void *init_audio_out_plugin (config_values_t *config)
/* allocate struct */
this = (irixal_driver_t *) calloc (sizeof (irixal_driver_t), 1);
+ if (!this)
+ return NULL;
/* get capabilities */
if ( (numvalues = alQueryValues (useresource, AL_CHANNELS, values, 32, NULL, 0)) > 0)
diff --git a/src/audio_out/audio_none_out.c b/src/audio_out/audio_none_out.c
index 65431e5e1..0f0673431 100644
--- a/src/audio_out/audio_none_out.c
+++ b/src/audio_out/audio_none_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_none_out.c,v 1.10 2006/07/10 22:08:12 dgp85 Exp $
+ * $Id: audio_none_out.c,v 1.11 2006/07/16 16:18:09 dsalt Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -189,6 +189,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen,
lprintf ("open_plugin called\n");
this = (none_driver_t *) xine_xmalloc (sizeof (none_driver_t));
+ if (!this)
+ return NULL;
this->xine = class->xine;
this->capabilities = AO_CAP_MODE_MONO | AO_CAP_MODE_STEREO;
@@ -237,6 +239,8 @@ static void *init_class (xine_t *xine, void *data) {
lprintf ("init class\n");
this = (none_class_t *) xine_xmalloc (sizeof (none_class_t));
+ if (!this)
+ return NULL;
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;
diff --git a/src/audio_out/audio_oss_out.c b/src/audio_out/audio_oss_out.c
index 5874f0449..366fa250c 100644
--- a/src/audio_out/audio_oss_out.c
+++ b/src/audio_out/audio_oss_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_oss_out.c,v 1.116 2006/07/10 22:08:12 dgp85 Exp $
+ * $Id: audio_oss_out.c,v 1.117 2006/07/16 16:18:09 dsalt Exp $
*
* 20-8-2001 First implementation of Audio sync and Audio driver separation.
* Copyright (C) 2001 James Courtier-Dutton James@superbug.demon.co.uk
@@ -723,6 +723,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
this = (oss_driver_t *) xine_xmalloc (sizeof (oss_driver_t));
+ if (!this)
+ return NULL;
/*
* find best device driver/channel
@@ -1159,6 +1161,8 @@ static void *init_class (xine_t *xine, void *data) {
oss_class_t *this;
this = (oss_class_t *) xine_xmalloc (sizeof (oss_class_t));
+ if (!this)
+ return NULL;
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;
diff --git a/src/audio_out/audio_polyp_out.c b/src/audio_out/audio_polyp_out.c
index 208b3500c..83fb10d2a 100644
--- a/src/audio_out/audio_polyp_out.c
+++ b/src/audio_out/audio_polyp_out.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2003 the xine project
+ * Copyright (C) 2000-2006 the xine project
*
* This file is part of xine, a free video player.
*
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_polyp_out.c,v 1.8 2006/07/10 22:08:12 dgp85 Exp $
+ * $Id: audio_polyp_out.c,v 1.9 2006/07/16 16:18:09 dsalt Exp $
*
* ao plugin for polypaudio:
* http://0pointer.de/lennart/projects/polypaudio/
@@ -458,6 +458,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
lprintf ("audio_polyp_out: open_plugin called\n");
this = (polyp_driver_t *) xine_xmalloc (sizeof (polyp_driver_t));
+ if (!this)
+ return NULL;
this->xine = class->xine;
/*
@@ -549,6 +551,8 @@ static void *init_class (xine_t *xine, void *data) {
lprintf ("audio_polyp_out: init class\n");
this = (polyp_class_t *) xine_xmalloc (sizeof (polyp_class_t));
+ if (!this)
+ return NULL;
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;
diff --git a/src/audio_out/audio_pulse_out.c b/src/audio_out/audio_pulse_out.c
index 08fe731e6..52eed33bb 100644
--- a/src/audio_out/audio_pulse_out.c
+++ b/src/audio_out/audio_pulse_out.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2003 the xine project
+ * Copyright (C) 2000-2006 the xine project
*
* This file is part of xine, a free video player.
*
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_pulse_out.c,v 1.1 2006/07/11 05:20:32 dgp85 Exp $
+ * $Id: audio_pulse_out.c,v 1.2 2006/07/16 16:18:09 dsalt Exp $
*
* ao plugin for pulseaudio (rename of polypaudio):
* http://0pointer.de/lennart/projects/pulsaudio/
@@ -466,6 +466,8 @@ static ao_driver_t *open_plugin (audio_driver_class_t *class_gen, const void *da
lprintf ("audio_pulse_out: open_plugin called\n");
this = (pulse_driver_t *) xine_xmalloc (sizeof (pulse_driver_t));
+ if (!this)
+ return NULL;
this->xine = class->xine;
/*
@@ -557,6 +559,8 @@ static void *init_class (xine_t *xine, void *data) {
lprintf ("audio_pulse_out: init class\n");
this = (pulse_class_t *) xine_xmalloc (sizeof (pulse_class_t));
+ if (!this)
+ return NULL;
this->driver_class.open_plugin = open_plugin;
this->driver_class.get_identifier = get_identifier;
diff --git a/src/audio_out/audio_sun_out.c b/src/audio_out/audio_sun_out.c
index cb1a1d2e1..95e38d811 100644
--- a/src/audio_out/audio_sun_out.c
+++ b/src/audio_out/audio_sun_out.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: audio_sun_out.c,v 1.44 2006/07/10 22:08:12 dgp85 Exp $
+ * $Id: audio_sun_out.c,v 1.45 2006/07/16 16:18:09 dsalt Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -880,6 +880,8 @@ static ao_driver_t *ao_sun_open_plugin (audio_driver_class_t *class_gen, const v
audio_info_t info;
this = (sun_driver_t *) xine_xmalloc (sizeof (sun_driver_t));
+ if (!this)
+ return NULL;
this->xine = class->xine;
@@ -997,6 +999,8 @@ static void *ao_sun_init_class (xine_t *xine, void *data) {
sun_class_t *this;
this = (sun_class_t *) xine_xmalloc (sizeof (sun_class_t));
+ if (!this)
+ return NULL;
this->driver_class.open_plugin = ao_sun_open_plugin;
this->driver_class.get_identifier = ao_sun_get_identifier;