]> git.sesse.net Git - vlc/commitdiff
Cleaning (don't a message when the system runs out of memory) and fix a potential...
authorRémi Duraffort <ivoire@videolan.org>
Tue, 14 Oct 2008 19:16:59 +0000 (21:16 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Tue, 14 Oct 2008 21:17:48 +0000 (23:17 +0200)
modules/access/screen/screen.c
modules/access/v4l2/v4l2.c
modules/access_output/rtmp.c
modules/control/http/http.c
modules/demux/mp4/libmp4.c
modules/demux/real.c
modules/gui/pda/pda_callbacks.c
modules/misc/notify/notify.c
modules/misc/osd/osd_menu.c
src/input/stream.c

index aff35f8eecd7fd37601e48f4ad94c8bf19ff3c80..8287967b2498fde6a7645529274e867af2b9fc27 100644 (file)
@@ -341,9 +341,7 @@ void RenderCursor( demux_t *p_demux, int i_x, int i_y,
     if( !p_sys->p_blend )
     {
         p_sys->p_blend = vlc_object_create( p_demux, sizeof(filter_t) );
-        if( !p_sys->p_blend )
-            msg_Err( p_demux, "Could not allocate memory for blending module" );
-        else
+        if( p_sys->p_blend )
         {
             es_format_Init( &p_sys->p_blend->fmt_in, VIDEO_ES,
                             VLC_FOURCC('R','G','B','A') );
index f985e502b68eeaa20e88a50b7154631a67997c11..ebfe3e2efc18d7398302e602c8e11aec0fcc67d8 100644 (file)
@@ -1717,10 +1717,7 @@ static int InitMmap( demux_t *p_demux, int i_fd )
 
     p_sys->p_buffers = calloc( req.count, sizeof( *p_sys->p_buffers ) );
     if( !p_sys->p_buffers )
-    {
-        msg_Err( p_demux, "Out of memory" );
         goto open_failed;
-    }
 
     for( p_sys->i_nbuffers = 0; p_sys->i_nbuffers < req.count; ++p_sys->i_nbuffers )
     {
index 8afbf95a12eb0920b1fd7653af9865157a2348dd..bc7caa35961412e7c6388c4956ebd0df95811144 100644 (file)
@@ -90,10 +90,7 @@ static int Open( vlc_object_t *p_this )
     int i;
 
     if( !( p_sys = calloc ( 1, sizeof( sout_access_out_sys_t ) ) ) )
-    {
-        msg_Err( p_access, "not enough memory" );
         return VLC_ENOMEM;
-    }
     p_access->p_sys = p_sys;
 
     p_sys->p_thread =
index bf706fe7c535cfd47f86734f3973b6a734f0a28c..08becdf796f0912ca5c384bf44d9417444827859 100644 (file)
@@ -263,10 +263,7 @@ static int Open( vlc_object_t *p_this )
         /* FIXME: we're leaking h */
         httpd_handler_sys_t *h = malloc( sizeof( httpd_handler_sys_t ) );
         if( !h )
-        {
-            msg_Err( p_intf, "not enough memory to allocate album art handler" );
             goto failed;
-        }
         h->file.p_intf = p_intf;
         h->file.file = NULL;
         h->file.name = NULL;
index cebdd94c28c73c70fbc640a6e7e39a1f496363fb..71a98375781395f4741b05533b7166087af34954 100644 (file)
@@ -1872,10 +1872,7 @@ static int MP4_ReadBox_cmvd( stream_t *p_stream, MP4_Box_t *p_box )
     p_box->data.p_cmvd->i_compressed_size = i_read;
 
     if( !( p_box->data.p_cmvd->p_data = malloc( i_read ) ) )
-    {
-        msg_Dbg( p_stream, "read box: \"cmvd\" not enough memory to load data" );
         return( 1 );
-    }
 
     /* now copy compressed data */
     memcpy( p_box->data.p_cmvd->p_data,
@@ -1949,11 +1946,7 @@ static int MP4_ReadBox_cmov( stream_t *p_stream, MP4_Box_t *p_box )
     /* decompress data */
     /* allocate a new buffer */
     if( !( p_data = malloc( p_cmvd->data.p_cmvd->i_uncompressed_size ) ) )
-    {
-        msg_Err( p_stream, "read box: \"cmov\" not enough memory to "
-                 "uncompress data" );
         return 1;
-    }
     /* init default structures */
     z_data.next_in   = p_cmvd->data.p_cmvd->p_data;
     z_data.avail_in  = p_cmvd->data.p_cmvd->i_compressed_size;
index 8d6fa6c17f5476f9ac18599d67351d4417a83ac5..571b6f85b96c44de0d78dbbbfa408df600f8125e 100644 (file)
@@ -931,10 +931,7 @@ static void ReadRealIndex( demux_t *p_demux )
     p_sys->p_index = 
             (rm_index_t *)malloc( sizeof( rm_index_t ) * (i_index_count+1) );
     if( p_sys->p_index == NULL )
-    {
-        msg_Err( p_demux, "Memory allocation error" ); 
         return;
-    }
 
     memset( p_sys->p_index, 0, sizeof(rm_index_t) * (i_index_count+1) );
 
index 2f8ffd1719d2d4155fc6a61c8c5577189f3be595..9165fcda6ed5444ec40a15a8d990fd90f9a1bc1a 100644 (file)
@@ -655,16 +655,12 @@ void onAddCameraToPlaylist(GtkButton *button, gpointer user_data)
 
     ppsz_options = (char **) malloc(11 *sizeof(char*));
     if (ppsz_options == NULL)
-    {
-        msg_Err(p_intf, "No memory to allocate for v4l options.");
         return;
-    }
     for (i=0; i<11; i++)
     {
         ppsz_options[i] = (char *) malloc(VLC_MAX_MRL * sizeof(char));
         if (ppsz_options[i] == NULL)
         {
-            msg_Err(p_intf, "No memory to allocate for v4l options string %i.", i);
             for (i-=1; i>=0; i--)
                 free(ppsz_options[i]);
             free(ppsz_options);
@@ -1021,16 +1017,12 @@ void onAddTranscodeToPlaylist(GtkButton *button, gpointer user_data)
 
     ppsz_options = (char **) malloc(3 *sizeof(char*));
     if (ppsz_options == NULL)
-    {
-        msg_Err(p_intf, "No memory to allocate for v4l options.");
         return;
-    }
     for (i=0; i<3; i++)
     {
         ppsz_options[i] = (char *) malloc(VLC_MAX_MRL * sizeof(char));
         if (ppsz_options[i] == NULL)
         {
-            msg_Err(p_intf, "No memory to allocate for v4l options string %i.", i);
             for (i-=1; i>=0; i--)
                 free(ppsz_options[i]);
             free(ppsz_options);
index e76903a490d4d54c9f50e51047244594f343cf9b..f1bcf9a1f48f305e5f3067acb68cb9ffe34bc9ca 100644 (file)
@@ -87,10 +87,7 @@ static int Open( vlc_object_t *p_this )
     intf_sys_t      *p_sys  = malloc( sizeof( intf_sys_t ) );
 
     if( !p_sys )
-    {
-        msg_Err( p_intf, "Out of memory" );
         return VLC_ENOMEM;
-    }
 
     if( !notify_init( APPLICATION_NAME ) )
     {
index 2be6c92318c96758be14f1197f47de267de1d9e7..f85cfc0ecc059190987d5555b4cac2194ee6fbae 100644 (file)
@@ -56,10 +56,7 @@ osd_menu_t *osd_MenuNew( osd_menu_t *p_menu, const char *psz_path,
 
     p_menu->p_state = (osd_menu_state_t *) malloc( sizeof( osd_menu_state_t ) );
     if( !p_menu->p_state )
-    {
-        msg_Err( p_menu, "Memory allocation for OSD Menu state failed" );
         return NULL;
-    }
 
     memset(p_menu->p_state, 0, sizeof(osd_menu_state_t));
     if( psz_path != NULL )
index 4688ceaf4d10e7cd60f6c65a0a957392b270a297..a6f16b0416c8566614e55eb9f655176a4588dfa4 100644 (file)
@@ -460,16 +460,12 @@ stream_t *stream_AccessNew( access_t *p_access, bool b_quick )
         p_sys->immediate.i_end = 0;
         p_sys->immediate.p_buffer = malloc( STREAM_CACHE_SIZE );
 
+        if( p_sys->immediate.p_buffer == NULL )
+            goto error;
+
         msg_Dbg( s, "p_buffer %p-%p",
                  p_sys->immediate.p_buffer,
                  &p_sys->immediate.p_buffer[STREAM_CACHE_SIZE] );
-
-        if( p_sys->immediate.p_buffer == NULL )
-        {
-            msg_Err( s, "Out of memory when allocating stream cache (%d bytes)",
-                        STREAM_CACHE_SIZE );
-            goto error;
-        }
     }
     else
     {
@@ -487,11 +483,7 @@ stream_t *stream_AccessNew( access_t *p_access, bool b_quick )
         p_sys->stream.i_tk     = 0;
         p_sys->stream.p_buffer = malloc( STREAM_CACHE_SIZE );
         if( p_sys->stream.p_buffer == NULL )
-        {
-            msg_Err( s, "Out of memory when allocating stream cache (%d bytes)",
-                        STREAM_CACHE_SIZE );
             goto error;
-        }
         p_sys->stream.i_used   = 0;
         access_Control( p_access, ACCESS_GET_MTU,
                          &p_sys->stream.i_read_size );