summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2003-10-31 17:25:20 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2003-10-31 17:25:20 +0000
commit68fb5107a56d7efcf82a7c8015fbc0f39434f056 (patch)
treea922d23615b9624900107d5943b0b123b073553d
parent1fbd6d1d81d24259a20ce2bcd77687bd69e8e7fd (diff)
downloadxine-lib-68fb5107a56d7efcf82a7c8015fbc0f39434f056.tar.gz
xine-lib-68fb5107a56d7efcf82a7c8015fbc0f39434f056.tar.bz2
First check the pointers on NULL values, then memset;
patch provided by Chris Rankin CVS patchset: 5650 CVS date: 2003/10/31 17:25:20
-rw-r--r--src/video_out/video_out_aa.c6
-rwxr-xr-xsrc/video_out/video_out_directx.c8
-rw-r--r--src/video_out/video_out_none.c6
-rw-r--r--src/video_out/video_out_sdl.c5
-rw-r--r--src/video_out/video_out_stk.c5
-rw-r--r--src/video_out/video_out_vidix.c5
-rw-r--r--src/video_out/video_out_xv.c4
-rw-r--r--src/video_out/video_out_xvmc.c4
8 files changed, 27 insertions, 16 deletions
diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c
index 569e8220c..17a947fee 100644
--- a/src/video_out/video_out_aa.c
+++ b/src/video_out/video_out_aa.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: video_out_aa.c,v 1.39 2003/10/23 15:17:07 mroi Exp $
+ * $Id: video_out_aa.c,v 1.40 2003/10/31 17:25:20 mroi Exp $
*
* video_out_aa.c, ascii-art output plugin for xine
*
@@ -107,6 +107,10 @@ static vo_frame_t *aa_alloc_frame(vo_driver_t *this) {
aa_frame_t *frame;
frame = (aa_frame_t *) malloc (sizeof (aa_frame_t));
+ if (frame == NULL) {
+ printf("aa_alloc_frame: out of memory\n");
+ return NULL;
+ }
memset (frame, 0, sizeof (aa_frame_t));
frame->vo_frame.proc_slice = NULL;
diff --git a/src/video_out/video_out_directx.c b/src/video_out/video_out_directx.c
index 9f0798c6c..8016e3a08 100755
--- a/src/video_out/video_out_directx.c
+++ b/src/video_out/video_out_directx.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000-2001 the xine project
+ * Copyright (C) 2000-2003 the xine project
*
* This file is part of xine, a unix video player.
*
@@ -20,7 +20,7 @@
* video_out_directx.c, direct draw video output plugin for xine
* by Matthew Grooms <elon@altavista.com>
*
- * $Id: video_out_directx.c,v 1.8 2003/10/23 15:17:07 mroi Exp $
+ * $Id: video_out_directx.c,v 1.9 2003/10/31 17:25:20 mroi Exp $
*/
typedef unsigned char boolean;
@@ -853,6 +853,10 @@ static vo_frame_t * win32_alloc_frame( vo_driver_t * vo_driver )
win32_frame_t * win32_frame;
win32_frame = ( win32_frame_t * ) malloc( sizeof( win32_frame_t ) );
+ if (win32_frame == NULL) {
+ printf("win32_alloc_frame: out of memory\n");
+ return NULL;
+ }
memset( win32_frame, 0, sizeof( win32_frame_t ) );
win32_frame->vo_frame.proc_slice = NULL;
diff --git a/src/video_out/video_out_none.c b/src/video_out/video_out_none.c
index 371ffb295..e54ed411a 100644
--- a/src/video_out/video_out_none.c
+++ b/src/video_out/video_out_none.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: video_out_none.c,v 1.17 2003/10/22 20:38:10 komadori Exp $
+ * $Id: video_out_none.c,v 1.18 2003/10/31 17:25:20 mroi Exp $
*
* Was originally part of toxine frontend.
* ...but has now been adapted to xine coding style standards ;)
@@ -88,13 +88,13 @@ static vo_frame_t *none_alloc_frame(vo_driver_t *vo_driver) {
none_frame_t *frame;
frame = (none_frame_t *) malloc(sizeof(none_frame_t));
- memset(frame, 0, sizeof(none_frame_t));
if(frame == NULL) {
printf ("video_out_none: out of memory in none_alloc_frame\n");
abort();
}
-
+ memset(frame, 0, sizeof(none_frame_t));
+
frame->vo_frame.base[0] = NULL;
frame->vo_frame.base[1] = NULL;
frame->vo_frame.base[2] = NULL;
diff --git a/src/video_out/video_out_sdl.c b/src/video_out/video_out_sdl.c
index 7d8219da1..df67ff08d 100644
--- a/src/video_out/video_out_sdl.c
+++ b/src/video_out/video_out_sdl.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: video_out_sdl.c,v 1.29 2003/10/23 15:17:07 mroi Exp $
+ * $Id: video_out_sdl.c,v 1.30 2003/10/31 17:25:20 mroi Exp $
*
* video_out_sdl.c, Simple DirectMedia Layer
*
@@ -134,11 +134,12 @@ static vo_frame_t *sdl_alloc_frame (vo_driver_t *this_gen) {
sdl_frame_t *frame ;
frame = (sdl_frame_t *) malloc (sizeof (sdl_frame_t));
- memset (frame, 0, sizeof(sdl_frame_t));
if (frame==NULL) {
printf ("sdl_alloc_frame: out of memory\n");
+ return NULL;
}
+ memset (frame, 0, sizeof(sdl_frame_t));
pthread_mutex_init (&frame->vo_frame.mutex, NULL);
diff --git a/src/video_out/video_out_stk.c b/src/video_out/video_out_stk.c
index 871214b34..a24c087ef 100644
--- a/src/video_out/video_out_stk.c
+++ b/src/video_out/video_out_stk.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: video_out_stk.c,v 1.7 2003/10/23 15:17:07 mroi Exp $
+ * $Id: video_out_stk.c,v 1.8 2003/10/31 17:25:20 mroi Exp $
*
* video_out_stk.c, Libstk Surface Video Driver
* more info on Libstk at http://www.libstk.org
@@ -129,10 +129,11 @@ static vo_frame_t *stk_alloc_frame(vo_driver_t *this_gen) {
stk_frame_t* frame;
//printf("video_out_stk: alloc_frame()\n");
frame = (stk_frame_t *)malloc(sizeof(stk_frame_t));
- memset(frame, 0, sizeof(stk_frame_t));
if (frame == NULL) {
printf("stk_alloc_frame: out of memory\n");
+ return NULL;
}
+ memset(frame, 0, sizeof(stk_frame_t));
/* populate the frame members*/
pthread_mutex_init (&frame->vo_frame.mutex, NULL);
diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c
index fe422b823..07de45ee1 100644
--- a/src/video_out/video_out_vidix.c
+++ b/src/video_out/video_out_vidix.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: video_out_vidix.c,v 1.49 2003/10/23 15:17:07 mroi Exp $
+ * $Id: video_out_vidix.c,v 1.50 2003/10/31 17:25:20 mroi Exp $
*
* video_out_vidix.c
*
@@ -386,11 +386,12 @@ static vo_frame_t *vidix_alloc_frame (vo_driver_t *this_gen) {
vidix_frame_t *frame ;
frame = (vidix_frame_t *) malloc (sizeof (vidix_frame_t));
- memset (frame, 0, sizeof(vidix_frame_t));
if (frame==NULL) {
printf ("vidix_alloc_frame: out of memory\n");
+ return NULL;
}
+ memset (frame, 0, sizeof(vidix_frame_t));
pthread_mutex_init (&frame->vo_frame.mutex, NULL);
diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c
index fc08b6bae..4ff74822b 100644
--- a/src/video_out/video_out_xv.c
+++ b/src/video_out/video_out_xv.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: video_out_xv.c,v 1.179 2003/10/24 22:34:50 f1rmb Exp $
+ * $Id: video_out_xv.c,v 1.180 2003/10/31 17:25:20 mroi Exp $
*
* video_out_xv.c, X11 video extension interface for xine
*
@@ -195,12 +195,12 @@ static vo_frame_t *xv_alloc_frame (vo_driver_t *this_gen) {
xv_frame_t *frame ;
frame = (xv_frame_t *) malloc (sizeof (xv_frame_t));
- memset (frame, 0, sizeof(xv_frame_t));
if (frame == NULL) {
printf ("xv_alloc_frame: out of memory\n");
return NULL;
}
+ memset (frame, 0, sizeof(xv_frame_t));
pthread_mutex_init (&frame->vo_frame.mutex, NULL);
diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c
index 892a1dbed..30e816fb4 100644
--- a/src/video_out/video_out_xvmc.c
+++ b/src/video_out/video_out_xvmc.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: video_out_xvmc.c,v 1.5 2003/10/27 16:31:35 miguelfreitas Exp $
+ * $Id: video_out_xvmc.c,v 1.6 2003/10/31 17:25:21 mroi Exp $
*
* video_out_xvmc.c, X11 video motion compensation extension interface for xine
*
@@ -569,12 +569,12 @@ static vo_frame_t *xvmc_alloc_frame (vo_driver_t *this_gen) {
lprintf ("video_out_xvmc: xvmc_alloc_frame\n");
frame = (xvmc_frame_t *) malloc (sizeof (xvmc_frame_t));
- memset (frame, 0, sizeof(xvmc_frame_t));
if (frame == NULL) {
printf ("xvmc_alloc_frame: out of memory\n");
return NULL;
}
+ memset (frame, 0, sizeof(xvmc_frame_t));
/* keep track of frames and how many frames alocated. */
this->frames[this->num_frame_buffers++] = frame;