Changeset 2c32483bbcf0016701438570b14dbfb344ac6f3e

Show
Ignore:
Timestamp:
08/05/07 10:27:54 (1 year ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1186302474 +0000
git-parent:

[c296e05be40c17b544b6f3e73ccd6bcbc10ff16f]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1186302474 +0000
Message:

Fix malloc error handling
(bug reported by David Thiel)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/audio_output/dec.c

    rd20dd24 r2c32483  
    281281    /* This necessarily allocates in the heap. */ 
    282282    aout_BufferAlloc( &p_input->input_alloc, duration, NULL, p_buffer ); 
    283     p_buffer->i_nb_samples = i_nb_samples; 
    284     p_buffer->i_nb_bytes = i_nb_samples * p_input->input.i_bytes_per_frame 
    285                               / p_input->input.i_frame_length; 
     283    if( p_buffer != NULL ) 
     284        p_buffer->i_nb_bytes = i_nb_samples * p_input->input.i_bytes_per_frame 
     285                                  / p_input->input.i_frame_length; 
    286286 
    287287    /* Suppose the decoder doesn't have more than one buffered buffer */ 
     
    290290    vlc_mutex_unlock( &p_input->lock ); 
    291291 
    292     if ( p_buffer == NULL ) 
    293     { 
    294         msg_Err( p_aout, "NULL buffer !" ); 
    295     } 
    296     else 
    297     { 
    298         p_buffer->start_date = p_buffer->end_date = 0; 
    299     } 
    300  
     292    if( p_buffer == NULL ) 
     293        return NULL; 
     294 
     295    p_buffer->i_nb_samples = i_nb_samples; 
     296    p_buffer->start_date = p_buffer->end_date = 0; 
    301297    return p_buffer; 
    302298}