summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/curl/curl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/curl/curl.c b/ext/curl/curl.c
index a67d0b2480..783ee20689 100644
--- a/ext/curl/curl.c
+++ b/ext/curl/curl.c
@@ -890,13 +890,13 @@ PHP_FUNCTION(curl_exec)
error = curl_easy_perform(ch->cp);
if (error != CURLE_OK) {
- if (ch->handlers->write->buf.c)
+ if (ch->handlers->write->buf.len > 0)
smart_str_free(&ch->handlers->write->buf);
SAVE_CURL_ERROR(ch, error);
RETURN_FALSE;
}
- if (ch->handlers->write->method == PHP_CURL_RETURN) {
+ if (ch->handlers->write->method == PHP_CURL_RETURN && ch->handlers->write->buf.len > 0) {
if (ch->handlers->write->type != PHP_CURL_BINARY)
smart_str_0(&ch->handlers->write->buf);
RETURN_STRINGL(ch->handlers->write->buf.c, ch->handlers->write->buf.len, 0);