coverity fixes
authorMichael Wallner <mike@php.net>
Wed, 14 Sep 2016 07:05:13 +0000 (09:05 +0200)
committerMichael Wallner <mike@php.net>
Wed, 14 Sep 2016 07:05:13 +0000 (09:05 +0200)
src/php_http_client_curl.c
src/php_http_client_curl_user.c
src/php_http_url.c

index 69b6ca7..cca6a27 100644 (file)
@@ -1633,7 +1633,7 @@ static ZEND_RESULT_CODE php_http_curlm_option_set_use_eventloop(php_http_option_
        php_http_client_t *client = userdata;
        php_http_client_curl_ops_t *ev_ops = NULL;
 
-       if (Z_TYPE_P(value) == IS_OBJECT && instanceof_function(Z_OBJCE_P(value), php_http_client_curl_user_get_class_entry())) {
+       if (value && Z_TYPE_P(value) == IS_OBJECT && instanceof_function(Z_OBJCE_P(value), php_http_client_curl_user_get_class_entry())) {
                ev_ops = php_http_client_curl_user_ops_get();
 #if PHP_HTTP_HAVE_EVENT
        } else if (value && zend_is_true(value)) {
index 66edae6..d345e27 100644 (file)
@@ -106,7 +106,7 @@ static int php_http_client_curl_user_socket(CURL *easy, curl_socket_t sock, int
                        return -1;
        }
 
-       if (action == CURL_POLL_REMOVE && ev) {
+       if (action == CURL_POLL_REMOVE) {
                php_stream_close(ev->socket);
                efree(ev);
                curl_multi_assign(curl->handle->multi, sock, NULL);
index 1a5f6ae..b828c46 100644 (file)
@@ -1078,7 +1078,7 @@ static const char *parse_ip6(struct parse_state *state, const char *ptr)
                }
                efree(addr);
        } else {
-               pos = tmp ? tmp - ptr : end - ptr;
+               pos = end - ptr;
                error = "expected ']'";
        }