From: RĂ©mi Duraffort Date: Sat, 21 Jun 2008 14:03:19 +0000 (+0200) Subject: Remove unneeded msg_Error about memory failure. X-Git-Tag: 0.9.0-test1~149 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=b674dab81ccd2a089896b26a2afc258118e6a990;p=vlc Remove unneeded msg_Error about memory failure. Fix a double malloc. Fix potential segfault. --- diff --git a/modules/access/cdda/access.c b/modules/access/cdda/access.c index d399ab9a81..bd33fb8680 100644 --- a/modules/access/cdda/access.c +++ b/modules/access/cdda/access.c @@ -634,7 +634,6 @@ int CDDAOpen( vlc_object_t *p_this ) p_cdda = calloc( 1, sizeof(cdda_data_t) ); if( p_cdda == NULL ) { - msg_Err( p_access, "out of memory" ); free( psz_source ); return VLC_ENOMEM; } diff --git a/modules/access/dc1394.c b/modules/access/dc1394.c index 34cd3aa42a..381e14a730 100644 --- a/modules/access/dc1394.c +++ b/modules/access/dc1394.c @@ -227,10 +227,7 @@ static int Open( vlc_object_t *p_this ) p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); if( !p_sys ) - { - msg_Err( p_demux, "not enough memory available" ); return VLC_ENOMEM; - } memset( p_sys, 0, sizeof( demux_sys_t ) ); memset( &fmt, 0, sizeof( es_format_t ) ); diff --git a/modules/access/http.c b/modules/access/http.c index 57e4b2e765..87bd3a1835 100644 --- a/modules/access/http.c +++ b/modules/access/http.c @@ -339,7 +339,7 @@ static int OpenWithCookies( vlc_object_t *p_this, vlc_array_t *cookies ) if (proxies[0]) { msg_Dbg(p_access, "libproxy suggest to use '%s'", proxies[0]); - if(strcmp(proxies[0],"direct://") != 0) + if(strcmp(proxies[0],"direct://") != 0) { p_sys->b_proxy = true; vlc_UrlParse( &p_sys->proxy, proxies[0], 0); diff --git a/modules/access/rtmp/access.c b/modules/access/rtmp/access.c index 41f7776876..8be1e0d27c 100644 --- a/modules/access/rtmp/access.c +++ b/modules/access/rtmp/access.c @@ -88,10 +88,7 @@ static int Open( vlc_object_t *p_this ) p_sys->p_thread = vlc_object_create( p_access, sizeof( rtmp_control_thread_t ) ); if( !p_sys->p_thread ) - { - msg_Err( p_access, "out of memory" ); return VLC_ENOMEM; - } vlc_object_attach( p_sys->p_thread, p_access ); /* Parse URI - remove spaces */ diff --git a/modules/access/v4l2/v4l2.c b/modules/access/v4l2/v4l2.c index 11374d8f9f..1bc4f35a59 100644 --- a/modules/access/v4l2/v4l2.c +++ b/modules/access/v4l2/v4l2.c @@ -1662,18 +1662,12 @@ static int InitRead( demux_t *p_demux, int i_fd, unsigned int i_buffer_size ) p_sys->p_buffers = calloc( 1, sizeof( *p_sys->p_buffers ) ); if( !p_sys->p_buffers ) - { - msg_Err( p_demux, "Out of memory" ); goto open_failed; - } p_sys->p_buffers[0].length = i_buffer_size; p_sys->p_buffers[0].start = malloc( i_buffer_size ); if( !p_sys->p_buffers[0].start ) - { - msg_Err( p_demux, "Out of memory" ); goto open_failed; - } return VLC_SUCCESS; diff --git a/modules/access/vcd/cdrom.c b/modules/access/vcd/cdrom.c index 8c03ccb640..ddf5e39555 100644 --- a/modules/access/vcd/cdrom.c +++ b/modules/access/vcd/cdrom.c @@ -96,10 +96,7 @@ vcddev_t *ioctl_Open( vlc_object_t *p_this, const char *psz_dev ) */ p_vcddev = (vcddev_t *)malloc( sizeof(vcddev_t) ); if( p_vcddev == NULL ) - { - msg_Err( p_this, "out of memory" ); return NULL; - } p_vcddev->i_vcdimage_handle = -1; p_vcddev->psz_dev = NULL; b_is_file = 1; @@ -211,10 +208,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, { *pp_sectors = malloc( (i_tracks + 1) * sizeof(int) ); if( *pp_sectors == NULL ) - { - msg_Err( p_this, "out of memory" ); return 0; - } memcpy( *pp_sectors, p_vcddev->p_sectors, (i_tracks + 1) * sizeof(int) ); } @@ -251,7 +245,6 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, *pp_sectors = malloc( (i_tracks + 1) * sizeof(int) ); if( *pp_sectors == NULL ) { - msg_Err( p_this, "out of memory" ); darwin_freeTOC( pTOC ); return 0; } @@ -360,7 +353,6 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, { free( *pp_sectors ); free( p_fulltoc ); - msg_Err( p_this, "out of memory" ); CloseHandle( hEvent ); return 0; } @@ -423,10 +415,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, *pp_sectors = malloc( (i_tracks + 1) * sizeof(int) ); if( *pp_sectors == NULL ) - { - msg_Err( p_this, "out of memory" ); return 0; - } for( i = 0 ; i <= i_tracks ; i++ ) { @@ -459,10 +448,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, *pp_sectors = malloc( (i_tracks + 1) * sizeof(int) ); if( *pp_sectors == NULL ) - { - msg_Err( p_this, "out of memory" ); return 0; - } toc_entries.address_format = CD_LBA_FORMAT; toc_entries.starting_track = 0; @@ -472,7 +458,6 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, malloc( toc_entries.data_len ); if( toc_entries.data == NULL ) { - msg_Err( p_this, "out of memory" ); free( *pp_sectors ); return 0; } @@ -518,10 +503,7 @@ int ioctl_GetTracksMap( vlc_object_t *p_this, const vcddev_t *p_vcddev, *pp_sectors = malloc( (i_tracks + 1) * sizeof(int) ); if( *pp_sectors == NULL ) - { - msg_Err( p_this, "out of memory" ); return 0; - } /* Fill the p_sectors structure with the track/sector matches */ for( i = 0 ; i <= i_tracks ; i++ ) diff --git a/modules/audio_filter/channel_mixer/dolby.c b/modules/audio_filter/channel_mixer/dolby.c index 032da2aa8d..0cfb7c0403 100644 --- a/modules/audio_filter/channel_mixer/dolby.c +++ b/modules/audio_filter/channel_mixer/dolby.c @@ -106,10 +106,7 @@ static int Create( vlc_object_t *p_this ) /* Allocate the memory needed to store the module's structure */ p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) ); if ( p_filter->p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); - return VLC_EGENERIC; - } + return VLC_ENOMEM; p_filter->p_sys->i_left = -1; p_filter->p_sys->i_center = -1; p_filter->p_sys->i_right = -1; diff --git a/modules/audio_filter/channel_mixer/headphone.c b/modules/audio_filter/channel_mixer/headphone.c index 668cd8cd01..4f903e8fbb 100644 --- a/modules/audio_filter/channel_mixer/headphone.c +++ b/modules/audio_filter/channel_mixer/headphone.c @@ -245,10 +245,7 @@ static int Init( vlc_object_t *p_this, struct aout_filter_sys_t * p_data p_data->p_atomic_operations = malloc( sizeof(struct atomic_operation_t) * p_data->i_nb_atomic_operations ); if( p_data->p_atomic_operations == NULL ) - { - msg_Err( p_this, "out of memory" ); return -1; - } /* For each virtual speaker, computes elementary wave propagation time * to each ear */ @@ -346,10 +343,7 @@ static int Init( vlc_object_t *p_this, struct aout_filter_sys_t * p_data } p_data->p_overflow_buffer = malloc( p_data->i_overflow_buffer_size ); if( p_data->p_atomic_operations == NULL ) - { - msg_Err( p_this, "out of memory" ); return -1; - } memset( p_data->p_overflow_buffer, 0 , p_data->i_overflow_buffer_size ); /* end */ @@ -411,10 +405,7 @@ static int Create( vlc_object_t *p_this ) /* Allocate the memory needed to store the module's structure */ p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) ); if( p_filter->p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); - return VLC_EGENERIC; - } + return VLC_ENOMEM; p_filter->p_sys->i_overflow_buffer_size = 0; p_filter->p_sys->p_overflow_buffer = NULL; p_filter->p_sys->i_nb_atomic_operations = 0; @@ -626,10 +617,7 @@ static int OpenFilter( vlc_object_t *p_this ) /* Allocate the memory needed to store the module's structure */ p_filter->p_sys = malloc( sizeof(struct filter_sys_t) ); if( p_filter->p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); - return VLC_EGENERIC; - } + return VLC_ENOMEM; p_filter->p_sys->i_overflow_buffer_size = 0; p_filter->p_sys->p_overflow_buffer = NULL; p_filter->p_sys->i_nb_atomic_operations = 0; diff --git a/modules/audio_filter/channel_mixer/mono.c b/modules/audio_filter/channel_mixer/mono.c index 5c1a293512..a6633249be 100644 --- a/modules/audio_filter/channel_mixer/mono.c +++ b/modules/audio_filter/channel_mixer/mono.c @@ -247,10 +247,7 @@ static int Init( vlc_object_t *p_this, struct filter_sys_t * p_data, p_data->p_atomic_operations = malloc( sizeof(struct atomic_operation_t) * p_data->i_nb_atomic_operations ); if( p_data->p_atomic_operations == NULL ) - { - msg_Err( p_this, "out of memory" ); return -1; - } /* For each virtual speaker, computes elementary wave propagation time * to each ear */ @@ -348,10 +345,7 @@ static int Init( vlc_object_t *p_this, struct filter_sys_t * p_data, } p_data->p_overflow_buffer = malloc( p_data->i_overflow_buffer_size ); if( p_data->p_atomic_operations == NULL ) - { - msg_Err( p_this, "out of memory" ); return -1; - } memset( p_data->p_overflow_buffer, 0, p_data->i_overflow_buffer_size ); /* end */ @@ -393,10 +387,7 @@ static int OpenFilter( vlc_object_t *p_this ) /* Allocate the memory needed to store the module's structure */ p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) ); if( p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); return VLC_EGENERIC; - } var_Create( p_this, MONO_CFG "downmix", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); diff --git a/modules/audio_filter/converter/a52tofloat32.c b/modules/audio_filter/converter/a52tofloat32.c index 5f6024cd80..895d7d8318 100644 --- a/modules/audio_filter/converter/a52tofloat32.c +++ b/modules/audio_filter/converter/a52tofloat32.c @@ -149,10 +149,7 @@ static int Create( vlc_object_t *p_this ) p_sys = malloc( sizeof(filter_sys_t) ); p_filter->p_sys = (struct aout_filter_sys_t *)p_sys; if( p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); return -1; - } i_ret = Open( VLC_OBJECT(p_filter), p_sys, p_filter->input, p_filter->output ); @@ -444,10 +441,7 @@ static int OpenFilter( vlc_object_t *p_this ) /* Allocate the memory needed to store the module's structure */ p_filter->p_sys = p_sys = malloc( sizeof(filter_sys_t) ); if( p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); - return VLC_EGENERIC; - } + return VLC_ENOMEM; i_ret = Open( VLC_OBJECT(p_filter), p_sys, p_filter->fmt_in.audio, p_filter->fmt_out.audio ); diff --git a/modules/audio_filter/converter/dtstofloat32.c b/modules/audio_filter/converter/dtstofloat32.c index 12f94a57a5..cc103e65b5 100644 --- a/modules/audio_filter/converter/dtstofloat32.c +++ b/modules/audio_filter/converter/dtstofloat32.c @@ -128,10 +128,7 @@ static int Create( vlc_object_t *p_this ) p_sys = malloc( sizeof(filter_sys_t) ); p_filter->p_sys = (struct aout_filter_sys_t *)p_sys; if( p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); return -1; - } i_ret = Open( VLC_OBJECT(p_filter), p_sys, p_filter->input, p_filter->output ); @@ -402,18 +399,7 @@ static int OpenFilter( vlc_object_t *p_this ) /* Allocate the memory needed to store the module's structure */ p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) ); if( p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); - return VLC_EGENERIC; - } - - /* Allocate the memory needed to store the module's structure */ - p_filter->p_sys = p_sys = malloc( sizeof(filter_sys_t) ); - if( p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); - return VLC_EGENERIC; - } + return VLC_ENOMEM; i_ret = Open( VLC_OBJECT(p_filter), p_sys, p_filter->fmt_in.audio, p_filter->fmt_out.audio ); diff --git a/modules/audio_filter/converter/dtstospdif.c b/modules/audio_filter/converter/dtstospdif.c index ea0cba3c70..cfe4260aab 100644 --- a/modules/audio_filter/converter/dtstospdif.c +++ b/modules/audio_filter/converter/dtstospdif.c @@ -91,10 +91,7 @@ static int Create( vlc_object_t *p_this ) /* Allocate the memory needed to store the module's structure */ p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) ); if( p_filter->p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); return VLC_ENOMEM; - } memset( p_filter->p_sys, 0, sizeof(struct aout_filter_sys_t) ); p_filter->p_sys->p_buf = 0; diff --git a/modules/audio_filter/converter/mpgatofixed32.c b/modules/audio_filter/converter/mpgatofixed32.c index 67ae4f8a53..1e2a773095 100644 --- a/modules/audio_filter/converter/mpgatofixed32.c +++ b/modules/audio_filter/converter/mpgatofixed32.c @@ -104,10 +104,7 @@ static int Create( vlc_object_t *p_this ) p_sys = malloc( sizeof(filter_sys_t) ); p_filter->p_sys = (struct aout_filter_sys_t *)p_sys; if( p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); return -1; - } /* Initialize libmad */ mad_stream_init( &p_sys->mad_stream ); @@ -316,10 +313,7 @@ static int OpenFilter( vlc_object_t *p_this ) /* Allocate the memory needed to store the module's structure */ p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) ); if( p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); return -1; - } p_sys->i_reject_count = 0; p_filter->pf_audio_filter = Convert; diff --git a/modules/audio_filter/resampler/bandlimited.c b/modules/audio_filter/resampler/bandlimited.c index f30748693d..a9c1bedd3d 100644 --- a/modules/audio_filter/resampler/bandlimited.c +++ b/modules/audio_filter/resampler/bandlimited.c @@ -119,10 +119,7 @@ static int Create( vlc_object_t *p_this ) /* Allocate the memory needed to store the module's structure */ p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) ); if( p_filter->p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); return VLC_ENOMEM; - } /* Calculate worst case for the length of the filter wing */ d_factor = (double)p_filter->output.i_rate @@ -135,10 +132,7 @@ static int Create( vlc_object_t *p_this ) /* Allocate enough memory to buffer previous samples */ p_filter->p_sys->p_buf = malloc( p_filter->p_sys->i_buf_size ); if( p_filter->p_sys->p_buf == NULL ) - { - msg_Err( p_filter, "out of memory" ); return VLC_ENOMEM; - } p_filter->p_sys->i_old_wing = 0; p_filter->pf_do_work = DoWork; diff --git a/modules/audio_filter/resampler/linear.c b/modules/audio_filter/resampler/linear.c index 2a51cd2e58..badd99eafb 100644 --- a/modules/audio_filter/resampler/linear.c +++ b/modules/audio_filter/resampler/linear.c @@ -99,17 +99,11 @@ static int Create( vlc_object_t *p_this ) p_sys = malloc( sizeof(filter_sys_t) ); p_filter->p_sys = (struct aout_filter_sys_t *)p_sys; if( p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); return VLC_ENOMEM; - } p_sys->p_prev_sample = malloc( p_filter->input.i_channels * sizeof(int32_t) ); if( p_sys->p_prev_sample == NULL ) - { - msg_Err( p_filter, "out of memory" ); return VLC_ENOMEM; - } aout_DateInit( &p_sys->end_date, p_filter->output.i_rate ); p_filter->pf_do_work = DoWork; @@ -275,16 +269,12 @@ static int OpenFilter( vlc_object_t *p_this ) /* Allocate the memory needed to store the module's structure */ p_filter->p_sys = p_sys = malloc( sizeof(struct filter_sys_t) ); if( p_sys == NULL ) - { - msg_Err( p_filter, "out of memory" ); return VLC_ENOMEM; - } p_sys->p_prev_sample = malloc( p_filter->fmt_in.audio.i_channels * sizeof(int32_t) ); if( p_sys->p_prev_sample == NULL ) { - msg_Err( p_filter, "out of memory" ); free( p_sys ); return VLC_ENOMEM; } diff --git a/modules/misc/freetype.c b/modules/misc/freetype.c index 1f5850c4d6..35a646122d 100644 --- a/modules/misc/freetype.c +++ b/modules/misc/freetype.c @@ -289,10 +289,7 @@ static int Create( vlc_object_t *p_this ) /* Allocate structure */ p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) ); if( !p_sys ) - { - msg_Err( p_filter, "out of memory" ); return VLC_ENOMEM; - } p_sys->p_face = 0; p_sys->p_library = 0; p_sys->i_font_size = 0; @@ -324,10 +321,7 @@ static int Create( vlc_object_t *p_this ) free( psz_fontfile ); psz_fontfile = (char *)malloc( PATH_MAX + 1 ); if( !psz_fontfile ) - { - msg_Err( p_filter, "out of memory" ); goto error; - } #ifdef WIN32 GetWindowsDirectory( psz_fontfile, PATH_MAX + 1 ); strcat( psz_fontfile, "\\fonts\\arial.ttf" ); @@ -1128,10 +1122,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, psz_unicode = psz_unicode_orig = malloc( ( strlen(psz_string) + 1 ) * sizeof(uint32_t) ); if( psz_unicode == NULL ) - { - msg_Err( p_filter, "out of memory" ); goto error; - } #if defined(WORDS_BIGENDIAN) iconv_handle = vlc_iconv_open( "UCS-4BE", "UTF-8" ); #else @@ -1174,10 +1165,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, p_fribidi_string = malloc( (i_string_length + 1) * sizeof(uint32_t) ); if( !p_fribidi_string ) - { - msg_Err( p_filter, "out of memory" ); goto error; - } /* Do bidi conversion line-by-line */ while( pos < i_string_length ) @@ -1218,10 +1206,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, /* Calculate relative glyph positions and a bounding box for the * entire string */ if( !(p_line = NewLine( strlen( psz_string ))) ) - { - msg_Err( p_filter, "out of memory" ); goto error; - } p_lines = p_line; i_pen_x = i_pen_y = 0; i_previous = i = 0; @@ -1242,10 +1227,7 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out, { psz_line_start = psz_unicode; if( !(p_next = NewLine( strlen( psz_string ))) ) - { - msg_Err( p_filter, "out of memory" ); goto error; - } p_line->p_next = p_next; p_line->i_width = line.xMax; p_line->i_height = face->size->metrics.height >> 6; @@ -2285,7 +2267,6 @@ static int ProcessLines( filter_t *p_filter, ! p_new_positions || ! p_levels ) { - msg_Err( p_filter, "out of memory" ); free( p_levels ); free( p_old_positions ); free( p_new_positions ); @@ -2500,7 +2481,6 @@ static int ProcessLines( filter_t *p_filter, malloc( (k - i_prev + 1) * sizeof( uint32_t )); if( !psz_unicode ) { - msg_Err( p_filter, "out of memory" ); if( p_face ) FT_Done_Face( p_face ); free( pp_char_styles ); free( psz_unicode ); @@ -2519,7 +2499,6 @@ static int ProcessLines( filter_t *p_filter, { if( !(p_line = NewLine( i_len - i_prev)) ) { - msg_Err( p_filter, "out of memory" ); if( p_face ) FT_Done_Face( p_face ); free( pp_char_styles ); free( psz_unicode ); diff --git a/modules/misc/logger.c b/modules/misc/logger.c index 36a320d077..360a04e2f5 100644 --- a/modules/misc/logger.c +++ b/modules/misc/logger.c @@ -167,10 +167,7 @@ static int Open( vlc_object_t *p_this ) /* Allocate instance and initialize some members */ p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) ); if( p_intf->p_sys == NULL ) - { - msg_Err( p_intf, "out of memory" ); return -1; - } psz_mode = var_CreateGetString( p_intf, "logmode" ); if( psz_mode ) diff --git a/modules/misc/quartztext.c b/modules/misc/quartztext.c index ae299ca157..ba78fef116 100644 --- a/modules/misc/quartztext.c +++ b/modules/misc/quartztext.c @@ -142,10 +142,7 @@ static int Create( vlc_object_t *p_this ) // Allocate structure p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) ); if( !p_sys ) - { - msg_Err( p_filter, "out of memory" ); return VLC_ENOMEM; - } p_sys->psz_font_name = strdup( DEFAULT_FONT ); p_sys->i_font_opacity = 255; p_sys->i_font_color = DEFAULT_FONT_COLOR; diff --git a/modules/misc/rtsp.c b/modules/misc/rtsp.c index 450551d9ef..c162b1877b 100644 --- a/modules/misc/rtsp.c +++ b/modules/misc/rtsp.c @@ -365,10 +365,7 @@ static vod_media_t *MediaNew( vod_t *p_vod, const char *psz_name, int i; if( !p_media ) - { - msg_Err( p_vod, "not enough memory" ); return NULL; - } memset( p_media, 0, sizeof(vod_media_t) ); p_media->id = p_sys->i_media_id++; diff --git a/modules/misc/xml/xtag.c b/modules/misc/xml/xtag.c index e3b5193cba..b5eb64bcc7 100644 --- a/modules/misc/xml/xtag.c +++ b/modules/misc/xml/xtag.c @@ -178,10 +178,8 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *s ) /* Open and read file */ p_buffer = malloc( i_buffer ); - if( p_buffer == NULL ) { - msg_Err( p_xml, "out of memory" ); + if( p_buffer == NULL ) return NULL; - } while( ( i_size = stream_Read( s, &p_buffer[i_pos], 2048 ) ) == 2048 ) { @@ -190,7 +188,6 @@ static xml_reader_t *ReaderCreate( xml_t *p_xml, stream_t *s ) p_new = realloc( p_buffer, i_buffer ); if( !p_new ) { - msg_Err( p_xml, "out of memory" ); free( p_buffer ); return NULL; } diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c index af0c0c92a7..d18f71bc9d 100644 --- a/modules/stream_out/transcode.c +++ b/modules/stream_out/transcode.c @@ -739,10 +739,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) id = malloc( sizeof( sout_stream_id_t ) ); if( !id ) - { - msg_Err( p_stream, "out of memory" ); goto error; - } memset( id, 0, sizeof(sout_stream_id_t) ); id->id = NULL; @@ -752,10 +749,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) /* Create decoder object */ id->p_decoder = vlc_object_create( p_stream, VLC_OBJECT_DECODER ); if( !id->p_decoder ) - { - msg_Err( p_stream, "out of memory" ); goto error; - } vlc_object_attach( id->p_decoder, p_stream ); id->p_decoder->p_module = NULL; id->p_decoder->fmt_in = *p_fmt; @@ -764,10 +758,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) /* Create encoder object */ id->p_encoder = vlc_object_create( p_stream, VLC_OBJECT_ENCODER ); if( !id->p_encoder ) - { - msg_Err( p_stream, "out of memory" ); goto error; - } vlc_object_attach( id->p_encoder, p_stream ); id->p_encoder->p_module = NULL; @@ -931,23 +922,26 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt ) return id; - error: - if( id->p_decoder ) +error: + if( id ) { - vlc_object_detach( id->p_decoder ); - vlc_object_release( id->p_decoder ); - id->p_decoder = NULL; - } + if( id->p_decoder ) + { + vlc_object_detach( id->p_decoder ); + vlc_object_release( id->p_decoder ); + id->p_decoder = NULL; + } - if( id->p_encoder ) - { - vlc_object_detach( id->p_encoder ); - es_format_Clean( &id->p_encoder->fmt_out ); - vlc_object_release( id->p_encoder ); - id->p_encoder = NULL; - } + if( id->p_encoder ) + { + vlc_object_detach( id->p_encoder ); + es_format_Clean( &id->p_encoder->fmt_out ); + vlc_object_release( id->p_encoder ); + id->p_encoder = NULL; + } - free( id ); + free( id ); + } return NULL; }