Hi Nikita,

On Sat, September 13, 2014 23:35, Nikita Popov wrote:
> On Sat, Sep 13, 2014 at 11:21 PM, Anatol Belski <a...@php.net> wrote:
>
>
>> Commit:    bce562b75efcdacc762a3b94915cdf02056b22dc
>> Author:    Anatol Belski <a...@php.net>         Sat, 13 Sep 2014 20:20:17
>> +0200
>> Parents:   e00d48490bbba38a2757b28dfd930dbdf4870331
>> Branches:  master
>>
>>
>> Link:
>> http://git.php.net/?p=php-src.git;a=commitdiff;h=bce562b75efcdacc762a3b9
>> 4915cdf02056b22dc
>>
>>
>> Log:
>> check emalloc() result
>>
>> Changed paths:
>> M  ext/standard/http_fopen_wrapper.c
>>
>>
>>
>> Diff:
>> diff --git a/ext/standard/http_fopen_wrapper.c
>> b/ext/standard/http_fopen_wrapper.c index 45fa637..d7b62e1 100644 ---
>> a/ext/standard/http_fopen_wrapper.c +++
>> b/ext/standard/http_fopen_wrapper.c @@ -587,6 +587,9 @@ finish:
>> /* ensure the header is only sent if user_agent is not
>> blank */ if (ua_len > sizeof(_UA_HEADER)) { ua = emalloc(ua_len + 1); +
>> if (NULL == ua) { +                               return NULL;
>> +                       }
>> if ((ua_len = slprintf(ua, ua_len, _UA_HEADER, ua_str)) > 0) { ua[ua_len]
>> = 0;
>> php_stream_write(stream, ua, ua_len);
>>
>
> emalloc is an infallible allocator, no need to check it for NULL.
>
yeah, it uses the preallocated memory pool. But what when it's out of
memory, was more about that case. Or will it be signaled then? Don't see
currently it would be done.

Regards

Anatol


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to