[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xine-cvslog
Subject:    [xine-cvs] CVS: xine-lib/src/video_out video_out_aa.c,1.39,1.40 video_out_directx.c,1.8,1.9 video_ou
From:       Michael Roitzsch <mroi () users ! sourceforge ! net>
Date:       2003-10-31 17:25:23
[Download RAW message or body]

Update of /cvsroot/xine/xine-lib/src/video_out
In directory sc8-pr-cvs1:/tmp/cvs-serv24936/src/video_out

Modified Files:
	video_out_aa.c video_out_directx.c video_out_none.c 
	video_out_sdl.c video_out_stk.c video_out_vidix.c 
	video_out_xv.c video_out_xvmc.c 
Log Message:
First check the pointers on NULL values, then memset;
patch provided by Chris Rankin


Index: video_out_aa.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/video_out/video_out_aa.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- video_out_aa.c	23 Oct 2003 15:17:07 -0000	1.39
+++ video_out_aa.c	31 Oct 2003 17:25:20 -0000	1.40
@@ -107,6 +107,10 @@
   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;

Index: video_out_directx.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/video_out/video_out_directx.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- video_out_directx.c	23 Oct 2003 15:17:07 -0000	1.8
+++ video_out_directx.c	31 Oct 2003 17:25:20 -0000	1.9
@@ -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.
  * 
@@ -853,6 +853,10 @@
 	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;

Index: video_out_none.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/video_out/video_out_none.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- video_out_none.c	22 Oct 2003 20:38:10 -0000	1.17
+++ video_out_none.c	31 Oct 2003 17:25:20 -0000	1.18
@@ -88,13 +88,13 @@
   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;

Index: video_out_sdl.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/video_out/video_out_sdl.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- video_out_sdl.c	23 Oct 2003 15:17:07 -0000	1.29
+++ video_out_sdl.c	31 Oct 2003 17:25:20 -0000	1.30
@@ -134,11 +134,12 @@
   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);
 

Index: video_out_stk.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/video_out/video_out_stk.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- video_out_stk.c	23 Oct 2003 15:17:07 -0000	1.7
+++ video_out_stk.c	31 Oct 2003 17:25:20 -0000	1.8
@@ -129,10 +129,11 @@
     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);

Index: video_out_vidix.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/video_out/video_out_vidix.c,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- video_out_vidix.c	23 Oct 2003 15:17:07 -0000	1.49
+++ video_out_vidix.c	31 Oct 2003 17:25:20 -0000	1.50
@@ -386,11 +386,12 @@
   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);
     

Index: video_out_xv.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/video_out/video_out_xv.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -r1.179 -r1.180
--- video_out_xv.c	24 Oct 2003 22:34:50 -0000	1.179
+++ video_out_xv.c	31 Oct 2003 17:25:20 -0000	1.180
@@ -195,12 +195,12 @@
   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);
 

Index: video_out_xvmc.c
===================================================================
RCS file: /cvsroot/xine/xine-lib/src/video_out/video_out_xvmc.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- video_out_xvmc.c	27 Oct 2003 16:31:35 -0000	1.5
+++ video_out_xvmc.c	31 Oct 2003 17:25:21 -0000	1.6
@@ -569,12 +569,12 @@
   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;



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Xine-cvslog mailing list
Xine-cvslog@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xine-cvslog
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic