Changeset 261fd89df68f7e4e1a5926c365d060033a5ec30a

Show
Ignore:
Timestamp:
05/10/08 20:01:11 (2 months ago)
Author:
Jean-Paul Saman <jpsaman@videolan.org>
git-committer:
Jean-Paul Saman <jpsaman@videolan.org> 1210442471 +0200
git-parent:

[38aaaeb38781b5087e8bf645c6aaf19520745093]

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

Check malloc return value and cleanup if allocation failed.

Files:

Legend:

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

    r38aaaeb r261fd89  
    431431 
    432432    tmp_url = (char *) malloc( strlen( "rtmp://") + strlen( p_thread->url.psz_buffer ) + 1 ); 
    433     /* FIXME: Handle error case when malloc FAILS */ 
     433    if( !tmp_url ) 
     434    { 
     435        free( rtmp_body->body ); 
     436        free( rtmp_body ); 
     437        return -1; 
     438    } 
    434439    sprintf( tmp_url, "rtmp://%s", p_thread->url.psz_buffer ); 
    435440    tmp_buffer = amf_encode_object_variable( "tcUrl", 
     
    18541859 
    18551860    description = (char *) malloc( strlen( "Playing and resetting ") + strlen( psz_media ) + strlen( "." ) + 1 ); 
    1856     /* FIXME: Handle error case when malloc FAILS */ 
    1857  
     1861    if( !description ) 
     1862    { 
     1863        free( rtmp_body->body ); 
     1864        free( rtmp_body ); 
     1865        return NULL; 
     1866    } 
    18581867    sprintf( description, "Playing and resetting %s.", psz_media ); 
    18591868    tmp_buffer = amf_encode_object_variable( "description", 
     
    19361945 
    19371946    description = (char *) malloc( strlen( "Started playing ") + strlen( psz_media ) + strlen( "." ) + 1 ); 
    1938     /* FIXME: Handle error case when MALLOC FAILS */ 
     1947    if( !description ) 
     1948    { 
     1949        free( rtmp_body->body ); 
     1950        free( rtmp_body ); 
     1951        return NULL; 
     1952    } 
    19391953 
    19401954    sprintf( description, "Started playing %s.", psz_media );