Mercurial > mplayer.hg
comparison libmpdemux/http.c @ 7304:7da2c2a68547
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.
author | bertrand |
---|---|
date | Sat, 07 Sep 2002 08:15:57 +0000 |
parents | 0d7942100437 |
children | 63a5e03f4346 |
comparison
equal
deleted
inserted
replaced
7303:e805ef05536c | 7304:7da2c2a68547 |
---|---|
43 http_hdr = NULL; | 43 http_hdr = NULL; |
44 } | 44 } |
45 | 45 |
46 int | 46 int |
47 http_response_append( HTTP_header_t *http_hdr, char *response, int length ) { | 47 http_response_append( HTTP_header_t *http_hdr, char *response, int length ) { |
48 char *ptr; | |
49 if( http_hdr==NULL || response==NULL || length<0 ) return -1; | 48 if( http_hdr==NULL || response==NULL || length<0 ) return -1; |
49 | |
50 http_hdr->buffer = (char*)realloc( http_hdr->buffer, http_hdr->buffer_size+length+1 ); | 50 http_hdr->buffer = (char*)realloc( http_hdr->buffer, http_hdr->buffer_size+length+1 ); |
51 if( ptr==NULL ) { | 51 if( http_hdr->buffer==NULL ) { |
52 mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory (re)allocation failed\n"); | 52 mp_msg(MSGT_NETWORK,MSGL_FATAL,"Memory (re)allocation failed\n"); |
53 return -1; | 53 return -1; |
54 } | 54 } |
55 memcpy( http_hdr->buffer+http_hdr->buffer_size, response, length ); | 55 memcpy( http_hdr->buffer+http_hdr->buffer_size, response, length ); |
56 http_hdr->buffer_size += length; | 56 http_hdr->buffer_size += length; |