Changeset 2f601f6314210a2ec7af4edd5364d63fbdf56e94

Show
Ignore:
Timestamp:
05/05/08 11:40:04 (7 months ago)
Author:
Rafaël Carré <funman@videolan.org>
git-committer:
Rafaël Carré <funman@videolan.org> 1209980404 +0200
git-parent:

[0451476b86e83f9f6d5ce9392572426c51f9e205]

git-author:
Rafaël Carré <funman@videolan.org> 1209980404 +0200
Message:

Do not leak 1 byte per variable created

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/misc/variables.c

    r6da90a1 r2f601f6  
    5454    return v.i_time == w.i_time ? 0 : v.i_time > w.i_time ? 1 : -1; 
    5555} 
    56 static int CmpString( vlc_value_t v, vlc_value_t w ) { return strcmp( v.psz_string, w.psz_string ); } 
     56static int CmpString( vlc_value_t v, vlc_value_t w ) 
     57
     58    if( !v.psz_string ) 
     59        return !w.psz_string ? 0 : -1; 
     60    else 
     61        return !w.psz_string ? 1 : strcmp( v.psz_string, w.psz_string ); 
     62
    5763static int CmpFloat( vlc_value_t v, vlc_value_t w ) { return v.f_float == w.f_float ? 0 : v.f_float > w.f_float ? 1 : -1; } 
    5864static int CmpAddress( vlc_value_t v, vlc_value_t w ) { return v.p_address == w.p_address ? 0 : v.p_address > w.p_address ? 1 : -1; } 
     
    6268 *****************************************************************************/ 
    6369static void DupDummy( vlc_value_t *p_val ) { (void)p_val; /* unused */ } 
    64 static void DupString( vlc_value_t *p_val ) { p_val->psz_string = strdup( p_val->psz_string ); } 
     70static void DupString( vlc_value_t *p_val ) { if( p_val->psz_string ) p_val->psz_string = strdup( p_val->psz_string ); } 
    6571 
    6672static void DupList( vlc_value_t *p_val ) 
     
    248254            p_var->pf_dup = DupString; 
    249255            p_var->pf_free = FreeString; 
    250             p_var->val.psz_string = strdup( "" )
     256            p_var->val.psz_string = NULL
    251257            break; 
    252258        case VLC_VAR_FLOAT: