]> git.sesse.net Git - vlc/commitdiff
Don't print a message when an memory error occure and check some malloc return values.
authorRémi Duraffort <ivoire@videolan.org>
Mon, 12 May 2008 16:36:15 +0000 (18:36 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Mon, 12 May 2008 16:36:21 +0000 (18:36 +0200)
30 files changed:
modules/codec/a52.c
modules/codec/adpcm.c
modules/codec/araw.c
modules/codec/cc.c
modules/codec/cdg.c
modules/codec/cinepak.c
modules/codec/csri.c
modules/codec/cvdsub.c
modules/codec/dirac.c
modules/codec/dts.c
modules/codec/dvbsub.c
modules/codec/faad.c
modules/codec/flac.c
modules/codec/kate.c
modules/codec/lpcm.c
modules/codec/mash.cpp
modules/codec/mpeg_audio.c
modules/codec/png.c
modules/codec/quicktime.c
modules/codec/rawvideo.c
modules/codec/realaudio.c
modules/codec/sdl_image.c
modules/codec/speex.c
modules/codec/tarkin.c
modules/codec/telx.c
modules/codec/theora.c
modules/codec/twolame.c
modules/codec/vorbis.c
modules/codec/x264.c
modules/codec/zvbi.c

index f5104f941edf2ed7bc6f49f72dfecbf0761a439c..7f1caa9e7aae6db7a2479bbe40e9739a5d3ac3cf 100644 (file)
@@ -124,10 +124,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     /* Misc init */
     p_sys->b_packetizer = false;
index ecccdc9e4c5ffc978a937338043052a05e685587..30a9a9f80b083cbb2b3c9921c3678874837c28bd 100644 (file)
@@ -167,10 +167,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
         return VLC_ENOMEM;
-    }
 
     switch( p_dec->fmt_in.i_codec )
     {
index e6a953c17e13f31c6696b345a1a7a768a4d12063..48fd022e1c803493d287b90ce40744a3134910d7 100644 (file)
@@ -227,10 +227,7 @@ static int DecoderOpen( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     p_sys->p_logtos16 = NULL;
 
@@ -1424,10 +1421,7 @@ static int EncoderOpen( vlc_object_t *p_this )
     /* Allocate the memory needed to store the encoder's structure */
     if( ( p_enc->p_sys = p_sys =
           (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_enc, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     p_enc->pf_encode_audio = EncoderEncode;
     p_enc->fmt_in.i_codec = p_enc->fmt_out.i_codec;
index 1e7a71a6ce4e0a6e55186e71612b5682ff8aabb8..fa7b4537686e20e219e08a01a70661b154ae4a90 100644 (file)
@@ -199,10 +199,7 @@ static int Open( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     p_dec->p_sys = p_sys = malloc( sizeof( *p_sys ) );
     if( p_sys == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
         return VLC_ENOMEM;
-    }
 
     /* init of p_sys */
     memset( p_sys, 0, sizeof( *p_sys ) );
@@ -1110,6 +1107,8 @@ static char *Eia608Text( eia608_t *h, bool b_html )
 
     /* We allocate a buffer big enough for normal case */
     psz = malloc( i_size );
+    if( !psz )
+        return NULL;
     *psz = '\0';
     if( b_html )
         Eia608Strlcat( psz, "<text>", i_size );
index a11b579df6ad5fc1a5abb94015733e2d055d9a6a..5823563141fc9df78f17dd3f074d02455878cc8e 100644 (file)
@@ -103,10 +103,7 @@ static int Open( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     p_dec->p_sys = p_sys = malloc(sizeof(decoder_sys_t));
     if( !p_sys )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     /* Init */
     memset( p_sys, 0, sizeof(*p_sys) );
index e29d670688f76166b62389d27979df68a5805651..daa4af08b1a583e6574c91ec9fe3ed605f1bc093 100644 (file)
@@ -116,10 +116,7 @@ static int OpenDecoder( vlc_object_t *p_this )
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys = malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
     memset( &p_sys->context, 0, sizeof( cinepak_context_t ) );
 
     var_Create( p_dec, "grayscale", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
@@ -448,6 +445,8 @@ static int cinepak_decode_frame( cinepak_context_t *p_context,
         {
             p_context->p_pix[i] = malloc( p_context->i_stride[i] *
                                           p_context->i_lines[i] );
+            if( p_context->p_pix[i] == NULL )
+                return -1;
             /* Set it to all black */
             memset( p_context->p_pix[i], ( i == 0 ) ? 0 : 128 ,
                     p_context->i_stride[i] * p_context->i_lines[i] );
index 5813638684179124139c6686d5cab8d85b10e324..1ce6e1429cb34d700fceebbe4fa21e8405ecc3cf 100644 (file)
@@ -126,10 +126,7 @@ static int Create( vlc_object_t *p_this )
 
     p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
     if( !p_sys )
-    {
-        msg_Err( p_dec, "out of memory" );
         return VLC_ENOMEM;
-    }
     memset( &p_dec->p_sys->fmt_cached, 0, sizeof( p_dec->p_sys->fmt_cached ) );
 
     p_sys->pf_push_packet = p_streamext->push_packet;
@@ -180,7 +177,6 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     p_spu->p_sys = malloc( sizeof( subpicture_sys_t ));
     if( !p_spu->p_sys )
     {
-        msg_Err( p_dec, "out of memory" );
         p_dec->pf_spu_buffer_del( p_dec, p_spu );
         block_Release( *pp_block );
         *pp_block = NULL;
@@ -192,7 +188,6 @@ static subpicture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
     p_spu->p_sys->p_subs_data = malloc( p_block->i_buffer );
     if( !p_spu->p_sys->p_subs_data )
     {
-        msg_Err( p_dec, "out of memory" );
         free( p_spu->p_sys );
         p_dec->pf_spu_buffer_del( p_dec, p_spu );
         block_Release( *pp_block );
index 7808b5b6e2f5d7fe53775fbb6342bfc7310a50fc..dfebeaf6c4b2c9679a3a76d15925cbd1615c2e28 100644 (file)
@@ -117,6 +117,8 @@ static int DecoderOpen( vlc_object_t *p_this )
     }
 
     p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
+    if( !p_sys )
+        return VLC_ENOMEM;
 
     p_sys->b_packetizer  = false;
 
index debd954542d344b3b4270c052aad79f03ee57e67..60264c06f9db5a271ff92588741d2e21a9227631 100644 (file)
@@ -110,10 +110,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     p_sys->p_dirac = p_dirac;
 
@@ -345,10 +342,7 @@ static int OpenEncoder( vlc_object_t *p_this )
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_enc, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
     memset( p_sys, 0, sizeof(encoder_sys_t) );
     p_enc->p_sys = p_sys;
 
index df3ef3d74c75131fe02ac86c372d12eb7c1b22a1..1ae39045e9007b28fab4c0ae0b650d5f4147e70c 100644 (file)
@@ -124,10 +124,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     /* Misc init */
     p_sys->b_packetizer = false;
index 6874006fafdc1af2ae34be197f7cb94e3b33c64e..a0af36e94a864fee1ba57b0728616669cf44b20f 100644 (file)
@@ -303,10 +303,7 @@ static int Open( vlc_object_t *p_this )
     p_dec->pf_decode_sub = Decode;
     p_sys = p_dec->p_sys = malloc( sizeof(decoder_sys_t) );
     if( !p_sys )
-    {
-        msg_Err( p_dec, "out of memory" );
         return VLC_ENOMEM;
-    }
     memset( p_sys, 0, sizeof(decoder_sys_t) );
 
     p_sys->i_pts          = (mtime_t) 0;
@@ -634,7 +631,9 @@ static void decode_clut( decoder_t *p_dec, bs_t *s )
 #ifdef DEBUG_DVBSUB
         msg_Dbg( p_dec, "new clut: %i", i_id );
 #endif
-        p_clut = malloc( sizeof(dvbsub_clut_t) );
+        p_clut = malloc( sizeof( dvbsub_clut_t ) );
+        if( !p_clut )
+            return;
         p_clut->p_next = p_sys->p_cluts;
         p_sys->p_cluts = p_clut;
     }
@@ -772,6 +771,8 @@ static void decode_page_composition( decoder_t *p_dec, bs_t *s )
 #endif
         /* Allocate a new page */
         p_sys->p_page = malloc( sizeof(dvbsub_page_t) );
+        if( !p_sys->p_page )
+            return;
     }
 
     p_sys->p_page->i_version = i_version;
index 59ffac2775853b4a955346e9e45dbd5a0b8dc1cb..0d922a6268e1b11278f1f29d4ffbd4e55ddc66fb 100644 (file)
@@ -127,10 +127,7 @@ static int Open( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     /* Open a faad context */
     if( ( p_sys->hfaad = faacDecOpen() ) == NULL )
index c9a46e0f07a30b5b3a8635e16cfccb20f4e5f64c..8f9bc567fc22ac7ca5b8c646d10f2abd97501010 100644 (file)
@@ -214,10 +214,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
         return VLC_ENOMEM;
-    }
 
     /* Misc init */
     aout_DateSet( &p_sys->end_date, 0 );
@@ -1230,10 +1227,7 @@ static int OpenEncoder( vlc_object_t *p_this )
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_enc, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
     p_enc->p_sys = p_sys;
     p_enc->pf_encode_audio = Encode;
     p_enc->fmt_out.i_codec = VLC_FOURCC('f','l','a','c');
index a399917c1e0773c5e7a5b7556f25fa1d8d570e55..6feaa685b7c0e4a596a1d56db14343c976fbcd04 100644 (file)
@@ -159,10 +159,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
         return VLC_ENOMEM;
-    }
 
     /* init of p_sys */
 #ifdef ENABLE_PACKETIZER
index 02a920d3a7804dbbef2e1ba92ce2e1ec9a400ba5..733856535a91a99110b57ece2418a9aaa856c11d 100644 (file)
@@ -113,10 +113,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     /* Misc init */
     p_sys->b_packetizer = false;
index abf3043e93693e3b3635bdf605ca5c9ef43b2360..6ff1f3bdacce2d43a4ecfec0ab74541455482dd6 100644 (file)
@@ -97,10 +97,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
     /* Misc init */
     p_sys->i_pts = 0;
     p_sys->b_inited = false;
index 3edf91a6c1f95df136cd33294ca47f5a6911539e..c04c1a1a721b1311a803673a229c9d2c1b687a90 100644 (file)
@@ -152,10 +152,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     /* Misc init */
     p_sys->b_packetizer = false;
index 47a256d8a57815914717fe9fcb198ed93629b97b..278828cddd7ec7587af3979de7e456d57fc27225 100644 (file)
@@ -79,10 +79,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = VIDEO_ES;
@@ -217,6 +214,8 @@ static picture_t *DecodeBlock( decoder_t *p_dec, block_t **pp_block )
 
     /* Decode picture */
     p_row_pointers = malloc( sizeof(png_bytep) * i_height );
+    if( !p_row_pointers )
+        goto error;
     for( i = 0; i < (int)i_height; i++ )
         p_row_pointers[i] = p_pic->p->p_pixels + p_pic->p->i_pitch * i;
 
index e42eb2749fb9a60dc8dbfb499f0ef83535780445..ced2e19a262ae551af838ef441a29977a9e52c7d 100644 (file)
@@ -462,6 +462,8 @@ static int OpenAudio( decoder_t *p_dec )
     p_sys->i_buffer      = 0;
     p_sys->i_buffer_size = 100*1000;
     p_sys->p_buffer      = malloc( p_sys->i_buffer_size );
+    if( !p_sys->p_buffer )
+        goto exit_error;
 
     p_sys->i_out = 0;
     p_sys->i_out_frames = 0;
@@ -621,6 +623,8 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
 static int OpenVideo( decoder_t *p_dec )
 {
     decoder_sys_t *p_sys = malloc( sizeof( decoder_sys_t ) );
+    if( !p_sys )
+        return VLC_ENOMEM;
 
 #ifndef WIN32
     vlc_mutex_t                        *lock;
@@ -716,6 +720,8 @@ static int OpenVideo( decoder_t *p_dec )
     /* codec data FIXME use codec not SVQ3 */
     msg_Dbg( p_dec, "vide = %d", i_vide  );
     id = malloc( sizeof( ImageDescription ) + ( i_vide - 70 ) );
+    if( !id )
+        goto exit_error;
     id->idSize          = sizeof( ImageDescription ) + ( i_vide - 70 );
     id->cType           = FCC( fcc[0], fcc[1], fcc[2], fcc[3] );
     id->version         = GetWBE ( p_vide +  0 );
@@ -752,6 +758,8 @@ static int OpenVideo( decoder_t *p_dec )
     memcpy( *p_sys->framedescHandle, id, id->idSize );
 
     p_sys->plane = malloc( p_dec->fmt_in.video.i_width * p_dec->fmt_in.video.i_height * 3 );
+    if( !p_sys->plane )
+        goto exit_error;
 
     i_result = p_sys->QTNewGWorldFromPtr( &p_sys->OutBufferGWorld,
                                           /*pixel format of new GWorld==YUY2 */
index fa4add7a005d3b6ca4850c40dd021f7717aabdaa..4e4185387eafc434091ed28e77180b1f584eaa35 100644 (file)
@@ -132,10 +132,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
     /* Misc init */
     p_dec->p_sys->b_packetizer = false;
     p_sys->i_pts = 0;
@@ -338,6 +335,8 @@ static block_t *SendFrame( decoder_t *p_dec, block_t *p_block )
         }
 
         p_tmp = malloc( pic.p[0].i_pitch );
+        if( !p_tmp )
+            return p_block;
         p_pixels = p_block->p_buffer;
         for( i = 0; i < pic.i_planes; i++ )
         {
index 505662c59a70e35be238543e122618453f3c9e53..f31c80621bc22ecf4c08292e4c2d9a6c71eccdf1 100644 (file)
@@ -201,6 +201,8 @@ static int Open( vlc_object_t *p_this )
     }
 
     p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
+    if( !p_sys )
+        return VLC_ENOMEM;
     memset( p_sys, 0, sizeof(decoder_sys_t) );
 
     /* Flavor for SIPR codecs */
@@ -236,6 +238,11 @@ static int Open( vlc_object_t *p_this )
     p_dec->pf_decode_audio = Decode;
 
     p_sys->p_out = malloc( 4096 * 10 );
+    if( !p_sys->p_out )
+    {
+        free( p_sys );
+        return VLC_ENOMEM;
+    }
     p_sys->i_out = 0;
 
     return VLC_SUCCESS;
index 39c53ac9ee35038fa9fe3ed0f7a9ab07a9ded10d..f2b64005314b44895d11bedcd90a76a2073aa512 100644 (file)
@@ -108,10 +108,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
     p_sys->psz_sdl_type = p_supported_fmt[i].psz_sdl_type;
 
     /* Set output properties - this is a decoy and isn't used anywhere */
index 2b8d1f564d1f752a44348a5578b9540777765b3d..dd343d01114c23f878ed5af744e785cfb19ade4f 100644 (file)
@@ -144,10 +144,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
     p_dec->p_sys->bits.buf_size = 0;
     p_dec->p_sys->b_packetizer = false;
     p_dec->p_sys->rtp_rate = p_dec->fmt_in.audio.i_rate;
@@ -865,10 +862,7 @@ static int OpenEncoder( vlc_object_t *p_this )
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_enc, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
     p_enc->p_sys = p_sys;
     p_enc->pf_encode_audio = Encode;
     p_enc->fmt_in.i_codec = AOUT_FMT_S16_NE;
index 93c4751e8400a5ce7ff472248103f8747dcbe082..c0465e184ab8de36e440b2937b6167e2844c958c 100644 (file)
@@ -101,10 +101,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     /* Set output properties */
     p_dec->fmt_out.i_cat = VIDEO_ES;
index bae938705d3385528f15b9edc6f92d36e5c9c4f6..a19b378a60355db1efdd546dd7f74eeec66519a5 100644 (file)
@@ -183,10 +183,7 @@ static int Open( vlc_object_t *p_this )
     p_dec->pf_decode_sub = Decode;
     p_sys = p_dec->p_sys = malloc( sizeof(decoder_sys_t) );
     if( p_sys == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
         return VLC_ENOMEM;
-    }
 
     memset( p_sys, 0, sizeof(decoder_sys_t) );
 
index e0003fd67d006fc76d5bf36eaf9c884f378e48a7..812baa96e117e71fd552f9127d0a287e9ad6b84b 100644 (file)
@@ -141,10 +141,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
     p_dec->p_sys->b_packetizer = false;
 
     p_sys->i_pts = 0;
@@ -612,10 +609,7 @@ static int OpenEncoder( vlc_object_t *p_this )
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_enc, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
     p_enc->p_sys = p_sys;
 
     p_enc->pf_encode_video = Encode;
index 0b4455bb0872b191be0ef7c261a05128ce6ae5fe..f3d5b2f908783096a40dffc238187e24280a0a19 100644 (file)
@@ -160,10 +160,7 @@ static int OpenEncoder( vlc_object_t *p_this )
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_enc, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
     p_enc->p_sys = p_sys;
 
     p_enc->pf_encode_audio = Encode;
index 39a8f0d71d4ba46b7cffe094b52a86b22d9e17b8..979b9af90cc98f3a33ec28df192168aea0588568 100644 (file)
@@ -244,10 +244,7 @@ static int OpenDecoder( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys =
           (decoder_sys_t *)malloc(sizeof(decoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     /* Misc init */
     aout_DateSet( &p_sys->end_date, 0 );
@@ -874,10 +871,7 @@ static int OpenEncoder( vlc_object_t *p_this )
 
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_sys = (encoder_sys_t *)malloc(sizeof(encoder_sys_t)) ) == NULL )
-    {
-        msg_Err( p_enc, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
     p_enc->p_sys = p_sys;
 
     p_enc->pf_encode_audio = Encode;
index 94c44c5a025fec8dbb6c1e1aabf83d47c4d193b2..d1183709b3d57e68777a29e4672a85a6103f1511 100644 (file)
@@ -769,6 +769,8 @@ static int  Open ( vlc_object_t *p_this )
     p_enc->pf_encode_video = Encode;
     p_enc->pf_encode_audio = NULL;
     p_enc->p_sys = p_sys = malloc( sizeof( encoder_sys_t ) );
+    if( !p_sys )
+        return VLC_ENOMEM;
     p_sys->i_interpolated_dts = 0;
     p_sys->psz_stat_name = NULL;
 
index 0cb60681ec58421bc91308f5637f4ed7b7c6ae8f..958954f598723bb9b2076f5ec25a83889d336d47 100644 (file)
@@ -388,10 +388,7 @@ static subpicture_t *Decode( decoder_t *p_dec, block_t **pp_block )
 
         p_pic = ( picture_t * ) malloc( sizeof( picture_t ) );
         if( !p_pic )
-        {
-            msg_Err( p_dec, "out of memory" );
             goto error;
-        }
 
         memset( &fmt_in, 0, sizeof( video_format_t ) );
         memset( p_pic, 0, sizeof( picture_t ) );