Changeset b674dab81ccd2a089896b26a2afc258118e6a990

Show
Ignore:
Timestamp:
06/22/08 21:41:15 (3 months ago)
Author:
Rémi Duraffort <ivoire@videolan.org>
git-committer:
Rémi Duraffort <ivoire@videolan.org> 1214163675 +0200
git-parent:

[7d1d56fec646569bd14262f6b9dde31becbe2137]

git-author:
Rémi Duraffort <ivoire@videolan.org> 1214056999 +0200
Message:

Remove unneeded msg_Error about memory failure.
Fix a double malloc.
Fix potential segfault.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/access/cdda/access.c

    rd974dcd rb674dab  
    635635    if( p_cdda == NULL ) 
    636636    { 
    637         msg_Err( p_access, "out of memory" ); 
    638637        free( psz_source ); 
    639638        return VLC_ENOMEM; 
  • modules/access/dc1394.c

    r3561b9b rb674dab  
    228228    p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); 
    229229    if( !p_sys ) 
    230     { 
    231         msg_Err( p_demux, "not enough memory available" ); 
    232230        return VLC_ENOMEM; 
    233     } 
    234231    memset( p_sys, 0, sizeof( demux_sys_t ) ); 
    235232    memset( &fmt, 0, sizeof( es_format_t ) ); 
  • modules/access/http.c

    r2c16687 rb674dab  
    340340                { 
    341341                    msg_Dbg(p_access, "libproxy suggest to use '%s'", proxies[0]); 
    342                     if(strcmp(proxies[0],"direct://") != 0)  
     342                    if(strcmp(proxies[0],"direct://") != 0) 
    343343                    { 
    344344                        p_sys->b_proxy = true; 
  • modules/access/rtmp/access.c

    r3561b9b rb674dab  
    8989        vlc_object_create( p_access, sizeof( rtmp_control_thread_t ) ); 
    9090    if( !p_sys->p_thread ) 
    91     { 
    92         msg_Err( p_access, "out of memory" ); 
    9391        return VLC_ENOMEM; 
    94     } 
    9592    vlc_object_attach( p_sys->p_thread, p_access ); 
    9693 
  • modules/access/v4l2/v4l2.c

    r3587742 rb674dab  
    16631663    p_sys->p_buffers = calloc( 1, sizeof( *p_sys->p_buffers ) ); 
    16641664    if( !p_sys->p_buffers ) 
    1665     { 
    1666         msg_Err( p_demux, "Out of memory" ); 
    16671665        goto open_failed; 
    1668     } 
    16691666 
    16701667    p_sys->p_buffers[0].length = i_buffer_size; 
    16711668    p_sys->p_buffers[0].start = malloc( i_buffer_size ); 
    16721669    if( !p_sys->p_buffers[0].start ) 
    1673     { 
    1674         msg_Err( p_demux, "Out of memory" ); 
    16751670        goto open_failed; 
    1676     } 
    16771671 
    16781672    return VLC_SUCCESS; 
  • modules/access/vcd/cdrom.c

    r3561b9b rb674dab  
    9797    p_vcddev = (vcddev_t *)malloc( sizeof(vcddev_t) ); 
    9898    if( p_vcddev == NULL ) 
    99     { 
    100         msg_Err( p_this, "out of memory" ); 
    10199        return NULL; 
    102     } 
    103100    p_vcddev->i_vcdimage_handle = -1; 
    104101    p_vcddev->psz_dev = NULL; 
     
    212209            *pp_sectors = malloc( (i_tracks + 1) * sizeof(int) ); 
    213210            if( *pp_sectors == NULL ) 
    214             { 
    215                 msg_Err( p_this, "out of memory" ); 
    216211                return 0; 
    217             } 
    218212            memcpy( *pp_sectors, p_vcddev->p_sectors, 
    219213                    (i_tracks + 1) * sizeof(int) ); 
     
    252246            if( *pp_sectors == NULL ) 
    253247            { 
    254                 msg_Err( p_this, "out of memory" ); 
    255248                darwin_freeTOC( pTOC ); 
    256249                return 0; 
     
    361354                    free( *pp_sectors ); 
    362355                    free( p_fulltoc ); 
    363                     msg_Err( p_this, "out of memory" ); 
    364356                    CloseHandle( hEvent ); 
    365357                    return 0; 
     
    424416                *pp_sectors = malloc( (i_tracks + 1) * sizeof(int) ); 
    425417                if( *pp_sectors == NULL ) 
    426                 { 
    427                     msg_Err( p_this, "out of memory" ); 
    428418                    return 0; 
    429                 } 
    430419 
    431420                for( i = 0 ; i <= i_tracks ; i++ ) 
     
    460449             *pp_sectors = malloc( (i_tracks + 1) * sizeof(int) ); 
    461450             if( *pp_sectors == NULL ) 
    462              { 
    463                  msg_Err( p_this, "out of memory" ); 
    464451                 return 0; 
    465              } 
    466452 
    467453             toc_entries.address_format = CD_LBA_FORMAT; 
     
    473459             if( toc_entries.data == NULL ) 
    474460             { 
    475                  msg_Err( p_this, "out of memory" ); 
    476461                 free( *pp_sectors ); 
    477462                 return 0; 
     
    519504            *pp_sectors = malloc( (i_tracks + 1) * sizeof(int) ); 
    520505            if( *pp_sectors == NULL ) 
    521             { 
    522                 msg_Err( p_this, "out of memory" ); 
    523506                return 0; 
    524             } 
    525507 
    526508            /* Fill the p_sectors structure with the track/sector matches */ 
  • modules/audio_filter/channel_mixer/dolby.c

    r3561b9b rb674dab  
    107107    p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) ); 
    108108    if ( p_filter->p_sys == NULL ) 
    109     { 
    110         msg_Err( p_filter, "out of memory" ); 
    111         return VLC_EGENERIC; 
    112     } 
     109        return VLC_ENOMEM; 
    113110    p_filter->p_sys->i_left = -1; 
    114111    p_filter->p_sys->i_center = -1; 
  • modules/audio_filter/channel_mixer/headphone.c

    r3561b9b rb674dab  
    246246            * p_data->i_nb_atomic_operations ); 
    247247    if( p_data->p_atomic_operations == NULL ) 
    248     { 
    249         msg_Err( p_this, "out of memory" ); 
    250248        return -1; 
    251     } 
    252249 
    253250    /* For each virtual speaker, computes elementary wave propagation time 
     
    347344    p_data->p_overflow_buffer = malloc( p_data->i_overflow_buffer_size ); 
    348345    if( p_data->p_atomic_operations == NULL ) 
    349     { 
    350         msg_Err( p_this, "out of memory" ); 
    351346        return -1; 
    352     } 
    353347    memset( p_data->p_overflow_buffer, 0 , p_data->i_overflow_buffer_size ); 
    354348 
     
    412406    p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) ); 
    413407    if( p_filter->p_sys == NULL ) 
    414     { 
    415         msg_Err( p_filter, "out of memory" ); 
    416         return VLC_EGENERIC; 
    417     } 
     408        return VLC_ENOMEM; 
    418409    p_filter->p_sys->i_overflow_buffer_size = 0; 
    419410    p_filter->p_sys->p_overflow_buffer = NULL; 
     
    627618    p_filter->p_sys = malloc( sizeof(struct filter_sys_t) ); 
    628619    if( p_filter->p_sys == NULL ) 
    629     { 
    630         msg_Err( p_filter, "out of memory" ); 
    631         return VLC_EGENERIC; 
    632     } 
     620        return VLC_ENOMEM; 
    633621    p_filter->p_sys->i_overflow_buffer_size = 0; 
    634622    p_filter->p_sys->p_overflow_buffer = NULL; 
  • modules/audio_filter/channel_mixer/mono.c

    r3561b9b rb674dab  
    248248            * p_data->i_nb_atomic_operations ); 
    249249    if( p_data->p_atomic_operations == NULL ) 
    250     { 
    251         msg_Err( p_this, "out of memory" ); 
    252250        return -1; 
    253     } 
    254251 
    255252    /* For each virtual speaker, computes elementary wave propagation time 
     
    349346    p_data->p_overflow_buffer = malloc( p_data->i_overflow_buffer_size ); 
    350347    if( p_data->p_atomic_operations == NULL ) 
    351     { 
    352         msg_Err( p_this, "out of memory" ); 
    353348        return -1; 
    354     } 
    355349    memset( p_data->p_overflow_buffer, 0, p_data->i_overflow_buffer_size ); 
    356350 
     
    394388    p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) ); 
    395389    if( p_sys == NULL ) 
    396     { 
    397         msg_Err( p_filter, "out of memory" ); 
    398390        return VLC_EGENERIC; 
    399     } 
    400391 
    401392    var_Create( p_this, MONO_CFG "downmix", 
  • modules/audio_filter/converter/a52tofloat32.c

    r55f1d32 rb674dab  
    150150    p_filter->p_sys = (struct aout_filter_sys_t *)p_sys; 
    151151    if( p_sys == NULL ) 
    152     { 
    153         msg_Err( p_filter, "out of memory" ); 
    154152        return -1; 
    155     } 
    156153 
    157154    i_ret = Open( VLC_OBJECT(p_filter), p_sys, 
     
    445442    p_filter->p_sys = p_sys = malloc( sizeof(filter_sys_t) ); 
    446443    if( p_sys == NULL ) 
    447     { 
    448         msg_Err( p_filter, "out of memory" ); 
    449         return VLC_EGENERIC; 
    450     } 
     444        return VLC_ENOMEM; 
    451445 
    452446    i_ret = Open( VLC_OBJECT(p_filter), p_sys, 
  • modules/audio_filter/converter/dtstofloat32.c

    r55f1d32 rb674dab  
    129129    p_filter->p_sys = (struct aout_filter_sys_t *)p_sys; 
    130130    if( p_sys == NULL ) 
    131     { 
    132         msg_Err( p_filter, "out of memory" ); 
    133131        return -1; 
    134     } 
    135132 
    136133    i_ret = Open( VLC_OBJECT(p_filter), p_sys, 
     
    403400    p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) ); 
    404401    if( p_sys == NULL ) 
    405     { 
    406         msg_Err( p_filter, "out of memory" ); 
    407         return VLC_EGENERIC; 
    408     } 
    409  
    410     /* Allocate the memory needed to store the module's structure */ 
    411     p_filter->p_sys = p_sys = malloc( sizeof(filter_sys_t) ); 
    412     if( p_sys == NULL ) 
    413     { 
    414         msg_Err( p_filter, "out of memory" ); 
    415         return VLC_EGENERIC; 
    416     } 
     402        return VLC_ENOMEM; 
    417403 
    418404    i_ret = Open( VLC_OBJECT(p_filter), p_sys, 
  • modules/audio_filter/converter/dtstospdif.c

    r3561b9b rb674dab  
    9292    p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) ); 
    9393    if( p_filter->p_sys == NULL ) 
    94     { 
    95         msg_Err( p_filter, "out of memory" ); 
    9694        return VLC_ENOMEM; 
    97     } 
    9895    memset( p_filter->p_sys, 0, sizeof(struct aout_filter_sys_t) ); 
    9996    p_filter->p_sys->p_buf = 0; 
  • modules/audio_filter/converter/mpgatofixed32.c

    r55f1d32 rb674dab  
    105105    p_filter->p_sys = (struct aout_filter_sys_t *)p_sys; 
    106106    if( p_sys == NULL ) 
    107     { 
    108         msg_Err( p_filter, "out of memory" ); 
    109107        return -1; 
    110     } 
    111108 
    112109    /* Initialize libmad */ 
     
    317314    p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) ); 
    318315    if( p_sys == NULL ) 
    319     { 
    320         msg_Err( p_filter, "out of memory" ); 
    321316        return -1; 
    322     } 
    323317    p_sys->i_reject_count = 0; 
    324318 
  • modules/audio_filter/resampler/bandlimited.c

    r3561b9b rb674dab  
    120120    p_filter->p_sys = malloc( sizeof(struct aout_filter_sys_t) ); 
    121121    if( p_filter->p_sys == NULL ) 
    122     { 
    123         msg_Err( p_filter, "out of memory" ); 
    124122        return VLC_ENOMEM; 
    125     } 
    126123 
    127124    /* Calculate worst case for the length of the filter wing */ 
     
    136133    p_filter->p_sys->p_buf = malloc( p_filter->p_sys->i_buf_size ); 
    137134    if( p_filter->p_sys->p_buf == NULL ) 
    138     { 
    139         msg_Err( p_filter, "out of memory" ); 
    140135        return VLC_ENOMEM; 
    141     } 
    142136 
    143137    p_filter->p_sys->i_old_wing = 0; 
  • modules/audio_filter/resampler/linear.c

    r3561b9b rb674dab  
    100100    p_filter->p_sys = (struct aout_filter_sys_t *)p_sys; 
    101101    if( p_sys == NULL ) 
    102     { 
    103         msg_Err( p_filter, "out of memory" ); 
    104102        return VLC_ENOMEM; 
    105     } 
    106103    p_sys->p_prev_sample = malloc( 
    107104        p_filter->input.i_channels * sizeof(int32_t) ); 
    108105    if( p_sys->p_prev_sample == NULL ) 
    109     { 
    110         msg_Err( p_filter, "out of memory" ); 
    111106        return VLC_ENOMEM; 
    112     } 
    113107    aout_DateInit( &p_sys->end_date, p_filter->output.i_rate ); 
    114108 
     
    276270    p_filter->p_sys = p_sys = malloc( sizeof(struct filter_sys_t) ); 
    277271    if( p_sys == NULL ) 
    278     { 
    279         msg_Err( p_filter, "out of memory" ); 
    280272        return VLC_ENOMEM; 
    281     } 
    282273 
    283274    p_sys->p_prev_sample = malloc( 
     
    285276    if( p_sys->p_prev_sample == NULL ) 
    286277    { 
    287         msg_Err( p_filter, "out of memory" ); 
    288278        free( p_sys ); 
    289279        return VLC_ENOMEM; 
  • modules/misc/freetype.c

    r3561b9b rb674dab  
    290290    p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) ); 
    291291    if( !p_sys ) 
    292     { 
    293         msg_Err( p_filter, "out of memory" ); 
    294292        return VLC_ENOMEM; 
    295     } 
    296293    p_sys->p_face = 0; 
    297294    p_sys->p_library = 0; 
     
    325322        psz_fontfile = (char *)malloc( PATH_MAX + 1 ); 
    326323        if( !psz_fontfile ) 
    327         { 
    328             msg_Err( p_filter, "out of memory" ); 
    329324            goto error; 
    330         } 
    331325#ifdef WIN32 
    332326        GetWindowsDirectory( psz_fontfile, PATH_MAX + 1 ); 
     
    11291123        malloc( ( strlen(psz_string) + 1 ) * sizeof(uint32_t) ); 
    11301124    if( psz_unicode == NULL ) 
    1131     { 
    1132         msg_Err( p_filter, "out of memory" ); 
    11331125        goto error; 
    1134     } 
    11351126#if defined(WORDS_BIGENDIAN) 
    11361127    iconv_handle = vlc_iconv_open( "UCS-4BE", "UTF-8" ); 
     
    11751166        p_fribidi_string = malloc( (i_string_length + 1) * sizeof(uint32_t) ); 
    11761167        if( !p_fribidi_string ) 
    1177         { 
    1178             msg_Err( p_filter, "out of memory" ); 
    11791168            goto error; 
    1180         } 
    11811169 
    11821170        /* Do bidi conversion line-by-line */ 
     
    12191207     * entire string */ 
    12201208    if( !(p_line = NewLine( strlen( psz_string ))) ) 
    1221     { 
    1222         msg_Err( p_filter, "out of memory" ); 
    12231209        goto error; 
    1224     } 
    12251210    p_lines = p_line; 
    12261211    i_pen_x = i_pen_y = 0; 
     
    12431228            psz_line_start = psz_unicode; 
    12441229            if( !(p_next = NewLine( strlen( psz_string ))) ) 
    1245             { 
    1246                 msg_Err( p_filter, "out of memory" ); 
    12471230                goto error; 
    1248             } 
    12491231            p_line->p_next = p_next; 
    12501232            p_line->i_width = line.xMax; 
     
    22862268            ! p_levels ) 
    22872269        { 
    2288             msg_Err( p_filter, "out of memory" ); 
    22892270            free( p_levels ); 
    22902271            free( p_old_positions ); 
     
    25012482            if( !psz_unicode ) 
    25022483            { 
    2503                 msg_Err( p_filter, "out of memory" ); 
    25042484                if( p_face ) FT_Done_Face( p_face ); 
    25052485                free( pp_char_styles ); 
     
    25202500                    if( !(p_line = NewLine( i_len - i_prev)) ) 
    25212501                    { 
    2522                         msg_Err( p_filter, "out of memory" ); 
    25232502                        if( p_face ) FT_Done_Face( p_face ); 
    25242503                        free( pp_char_styles ); 
  • modules/misc/logger.c

    r3561b9b rb674dab  
    168168    p_intf->p_sys = (intf_sys_t *)malloc( sizeof( intf_sys_t ) ); 
    169169    if( p_intf->p_sys == NULL ) 
    170     { 
    171         msg_Err( p_intf, "out of memory" ); 
    172170        return -1; 
    173     } 
    174171 
    175172    psz_mode = var_CreateGetString( p_intf, "logmode" ); 
  • modules/misc/quartztext.c

    r3561b9b rb674dab  
    143143    p_filter->p_sys = p_sys = malloc( sizeof( filter_sys_t ) ); 
    144144    if( !p_sys ) 
    145     { 
    146         msg_Err( p_filter, "out of memory" ); 
    147145        return VLC_ENOMEM; 
    148     } 
    149146    p_sys->psz_font_name  = strdup( DEFAULT_FONT ); 
    150147    p_sys->i_font_opacity = 255; 
  • modules/misc/rtsp.c

    r6145aa2 rb674dab  
    366366 
    367367    if( !p_media ) 
    368     { 
    369         msg_Err( p_vod, "not enough memory" ); 
    370368        return NULL; 
    371     } 
    372369 
    373370    memset( p_media, 0, sizeof(vod_media_t) ); 
  • modules/misc/xml/xtag.c

    r3561b9b rb674dab  
    179179    /* Open and read file */ 
    180180    p_buffer = malloc( i_buffer ); 
    181     if( p_buffer == NULL ) { 
    182         msg_Err( p_xml, "out of memory" ); 
     181    if( p_buffer == NULL ) 
    183182        return NULL; 
    184     } 
    185183 
    186184    while( ( i_size = stream_Read( s, &p_buffer[i_pos], 2048 ) ) == 2048 ) 
     
    191189        if( !p_new ) 
    192190        { 
    193             msg_Err( p_xml, "out of memory" ); 
    194191            free( p_buffer ); 
    195192            return NULL; 
  • modules/stream_out/transcode.c

    rf5623de rb674dab  
    740740    id = malloc( sizeof( sout_stream_id_t ) ); 
    741741    if( !id ) 
    742     { 
    743         msg_Err( p_stream, "out of memory" ); 
    744742        goto error; 
    745     } 
    746743    memset( id, 0, sizeof(sout_stream_id_t) ); 
    747744 
     
    753750    id->p_decoder = vlc_object_create( p_stream, VLC_OBJECT_DECODER ); 
    754751    if( !id->p_decoder ) 
    755     { 
    756         msg_Err( p_stream, "out of memory" ); 
    757752        goto error; 
    758     } 
    759753    vlc_object_attach( id->p_decoder, p_stream ); 
    760754    id->p_decoder->p_module = NULL; 
     
    765759    id->p_encoder = vlc_object_create( p_stream, VLC_OBJECT_ENCODER ); 
    766760    if( !id->p_encoder ) 
    767     { 
    768         msg_Err( p_stream, "out of memory" ); 
    769761        goto error; 
    770     } 
    771762    vlc_object_attach( id->p_encoder, p_stream ); 
    772763    id->p_encoder->p_module = NULL; 
     
    932923    return id; 
    933924 
    934  error: 
    935     if( id->p_decoder ) 
    936     { 
    937         vlc_object_detach( id->p_decoder ); 
    938         vlc_object_release( id->p_decoder ); 
    939         id->p_decoder = NULL; 
    940     } 
    941  
    942     if( id->p_encoder ) 
    943     { 
    944         vlc_object_detach( id->p_encoder ); 
    945         es_format_Clean( &id->p_encoder->fmt_out ); 
    946         vlc_object_release( id->p_encoder ); 
    947         id->p_encoder = NULL; 
    948     } 
    949  
    950     free( id ); 
     925error: 
     926    if( id ) 
     927    { 
     928        if( id->p_decoder ) 
     929        { 
     930            vlc_object_detach( id->p_decoder ); 
     931            vlc_object_release( id->p_decoder ); 
     932            id->p_decoder = NULL; 
     933        } 
     934 
     935        if( id->p_encoder ) 
     936        { 
     937            vlc_object_detach( id->p_encoder ); 
     938            es_format_Clean( &id->p_encoder->fmt_out ); 
     939            vlc_object_release( id->p_encoder ); 
     940            id->p_encoder = NULL; 
     941        } 
     942 
     943        free( id ); 
     944    } 
    951945    return NULL; 
    952946}