Changeset 46bcf2ee7c86c33dba989a3e131852319fb72bda

Show
Ignore:
Timestamp:
18/06/04 14:38:28 (4 years ago)
Author:
Sigmund Augdal Helberg <sigmunau@videolan.org>
git-committer:
Sigmund Augdal Helberg <sigmunau@videolan.org> 1087562308 +0000
git-parent:

[1e37a8cbae4a8d79f390ab393fdb9141e508b733]

git-author:
Sigmund Augdal Helberg <sigmunau@videolan.org> 1087562308 +0000
Message:

Fixed a nasty memleak in ugly and linear resamplers when alloca is
unavaliable. Also swaped the score of these modules.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/audio_filter/resampler/linear.c

    r5ca0ebc r46bcf2e  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: linear.c,v 1.11 2003/12/22 14:32:55 sam Exp
     5 * $Id
    66 * 
    77 * Authors: Gildas Bazin <gbazin@netcourrier.com> 
     
    5858vlc_module_begin(); 
    5959    set_description( _("audio filter for linear interpolation resampling") ); 
    60     set_capability( "audio filter", 2 ); 
     60    set_capability( "audio filter", 5 ); 
    6161    set_callbacks( Create, Close ); 
    6262vlc_module_end(); 
     
    119119                    aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) 
    120120{ 
    121     float *p_in, *p_out = (float *)p_out_buf->p_buffer; 
     121    float *p_in_orig, *p_in, *p_out = (float *)p_out_buf->p_buffer; 
    122122    float *p_prev_sample = (float *)p_filter->p_sys->p_prev_sample; 
    123123 
     
    146146    p_in = (float *)alloca( p_in_buf->i_nb_bytes ); 
    147147#else 
    148     p_in = (float *)malloc( p_in_buf->i_nb_bytes ); 
     148    p_in_orig = p_in = (float *)malloc( p_in_buf->i_nb_bytes ); 
    149149#endif 
    150150    if( p_in == NULL ) 
     
    227227        i_nb_channels * sizeof(int32_t); 
    228228 
     229#ifndef HAVE_ALLOCA 
     230    free( p_in_orig ); 
     231#endif 
     232 
    229233} 
  • modules/audio_filter/resampler/ugly.c

    r75426e2 r46bcf2e  
    33 ***************************************************************************** 
    44 * Copyright (C) 2002 VideoLAN 
    5  * $Id: ugly.c,v 1.9 2003/03/04 03:27:40 gbazin Exp
     5 * $Id
    66 * 
    77 * Authors: Samuel Hocevar <sam@zoy.org> 
     
    4545vlc_module_begin(); 
    4646    set_description( _("audio filter for ugly resampling") ); 
    47     set_capability( "audio filter", 5 ); 
     47    set_capability( "audio filter", 2 ); 
    4848    set_callbacks( Create, NULL ); 
    4949vlc_module_end(); 
     
    8383                    aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf ) 
    8484{ 
    85     int32_t *p_in, *p_out = (int32_t*)p_out_buf->p_buffer; 
     85    int32_t *p_in_orig, *p_in, *p_out = (int32_t*)p_out_buf->p_buffer; 
    8686 
    8787    unsigned int i_nb_channels = aout_FormatNbChannels( &p_filter->input ); 
     
    101101    p_in = (int32_t *)alloca( p_in_buf->i_nb_bytes ); 
    102102#else 
    103     p_in = (int32_t *)malloc( p_in_buf->i_nb_bytes ); 
     103    p_in_orig = p_in = (int32_t *)malloc( p_in_buf->i_nb_bytes ); 
    104104#endif 
    105105    if( p_in == NULL ) 
     
    132132    p_out_buf->end_date = p_out_buf->start_date + p_out_buf->i_nb_samples * 
    133133        1000000 / p_filter->output.i_rate; 
     134 
     135#ifndef HAVE_ALLOCA 
     136    free( p_in_orig ); 
     137#endif 
     138 
    134139}