changeset 25058:ac9507b338ac

Handle "out of memory" error.
author voroshil
date Sun, 18 Nov 2007 05:07:51 +0000
parents 7d74c1a2c840
children 501f31700e77
files stream/tvi_dshow.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream/tvi_dshow.c	Sun Nov 18 05:02:49 2007 +0000
+++ b/stream/tvi_dshow.c	Sun Nov 18 05:07:51 2007 +0000
@@ -2419,6 +2419,8 @@
     }
 
     priv->v_buf=calloc(1,sizeof(grabber_ringbuffer_t));
+    if(!priv->v_buf)
+        return E_OUTOFMEMORY;
 
     if (priv->tv_param->buffer_size >= 0) {
 	priv->v_buf->buffersize = priv->tv_param->buffer_size;
@@ -2458,6 +2460,8 @@
 
     if(priv->pmtAudio){
         priv->a_buf=calloc(1,sizeof(grabber_ringbuffer_t));
+        if(!priv->a_buf)
+            return E_OUTOFMEMORY;
 
         /* let the audio buffer be the same size (in seconds) than video one */
         priv->a_buf->buffersize=audio_buf_size_from_video(
@@ -2488,6 +2492,9 @@
     if(priv->tv_param->tdevice)
     {
         priv->vbi_buf=calloc(1,sizeof(grabber_ringbuffer_t));
+        if(!priv->vbi_buf)
+            return E_OUTOFMEMORY;
+
         init_ringbuffer(priv->vbi_buf,24,priv->tsp.bufsize);
 
         priv->pmtVBI=calloc(1,sizeof(AM_MEDIA_TYPE));