mirror of
https://github.com/mpv-player/mpv
synced 2024-12-19 13:21:13 +00:00
Check if realloc failed on http_hdr->buffer instead of ptr in http_response_append,
and got rid of ptr which wasn't used anymore. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7305 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
08cdd6368b
commit
e620b2a53c
@ -45,10 +45,10 @@ http_free( HTTP_header_t *http_hdr ) {
|
|||||||
|
|
||||||
int
|
int
|
||||||
http_response_append( HTTP_header_t *http_hdr, char *response, int length ) {
|
http_response_append( HTTP_header_t *http_hdr, char *response, int length ) {
|
||||||
char *ptr;
|
|
||||||
if( http_hdr==NULL || response==NULL || length<0 ) return -1;
|
if( http_hdr==NULL || response==NULL || length<0 ) return -1;
|
||||||
|
|
||||||
http_hdr->buffer = (char*)realloc( http_hdr->buffer, http_hdr->buffer_size+length+1 );
|
http_hdr->buffer = (char*)realloc( http_hdr->buffer, http_hdr->buffer_size+length+1 );
|
||||||
if( ptr==NULL ) {
|
if( http_hdr->buffer==NULL ) {
|
||||||
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory (re)allocation failed\n");
|
mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory (re)allocation failed\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user