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 69b6ca7c79d61fd369af32e324b94848492f62e5..cca6a27cd869422bed12e8c9a81058650b94153c 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 66edae664db2677cf0ef1490df05740415988cd1..d345e27e96bc30b2d7c985038073a011b885b9e5 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 1a5f6aebe3e4b6ddc06a8784c793b4e9a9388419..b828c46a817a904db182db4b108c509a0f954275 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 ']'";
        }