Changeset 5d5eb43ff8df8e03fc18db124982db027cf4e271

Show
Ignore:
Timestamp:
12/06/07 14:22:36 (1 year ago)
Author:
Jean-Paul Saman <jpsaman@videolan.org>
git-committer:
Jean-Paul Saman <jpsaman@videolan.org> 1181650956 +0000
git-parent:

[bd7d0c0914a76376947111eb3eaba98abb71f05a]

git-author:
Jean-Paul Saman <jpsaman@videolan.org> 1181650956 +0000
Message:

Fix potential memleaks

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/misc/freetype.c

    re3204e4 r5d5eb43  
    296296        if( psz_fontfile ) free( psz_fontfile ); 
    297297        psz_fontfile = (char *)malloc( PATH_MAX + 1 ); 
     298        if( !psz_fontfile ) 
     299        { 
     300            msg_Err( p_filter, "out of memory" ); 
     301            goto error; 
     302        } 
    298303#ifdef WIN32 
    299304        GetWindowsDirectory( psz_fontfile, PATH_MAX + 1 ); 
     
    862867{ 
    863868    filter_sys_t *p_sys = p_filter->p_sys; 
    864     line_desc_t  *p_lines = 0, *p_line = 0, *p_next = 0, *p_prev = 0
     869    line_desc_t  *p_lines = NULL, *p_line = NULL, *p_next = NULL, *p_prev = NULL
    865870    int i, i_pen_y, i_pen_x, i_error, i_glyph_index, i_previous; 
    866     uint32_t *psz_unicode, *psz_unicode_orig = 0, i_char, *psz_line_start; 
     871    uint32_t *psz_unicode, *psz_unicode_orig = NULL, i_char, *psz_line_start; 
    867872    int i_string_length; 
    868873    char *psz_string; 
     
    951956 
    952957        p_fribidi_string = malloc( (i_string_length + 1) * sizeof(uint32_t) ); 
     958        if( !p_fribidi_string ) 
     959        { 
     960            msg_Err( p_filter, "out of memory" ); 
     961            goto error; 
     962        } 
    953963 
    954964        /* Do bidi conversion line-by-line */ 
     
    11501160 
    11511161    p_new = malloc( sizeof( font_stack_t ) ); 
     1162    if( !p_new ) 
     1163        return VLC_ENOMEM; 
     1164 
    11521165    p_new->p_next = NULL; 
    11531166 
     
    12801293 
    12811294        p_fribidi_string = malloc( (i_string_length + 1) * sizeof(uint32_t) ); 
     1295        if( !p_fribidi_string ) 
     1296        { 
     1297            msg_Err( p_filter, "out of memory" ); 
     1298            free( psz_unicode ); 
     1299            return NULL; 
     1300        } 
    12821301 
    12831302        /* Do bidi conversion line-by-line */