X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fwrite_http.c;h=468892808f82e8bf5293664caa10c48ba79c4378;hb=ba4ddd3127e1ac4f98e09cbf255c8a10a1bd13eb;hp=6127c0426d2ba4fc36ffdd0d654f564b95b3a829;hpb=2079ee1517e34de372f58e7e2267ad5c71a8a41f;p=collectd.git diff --git a/src/write_http.c b/src/write_http.c index 6127c042..46889280 100644 --- a/src/write_http.c +++ b/src/write_http.c @@ -114,6 +114,7 @@ static int wh_post_nolock(wh_callback_t *cb, char const *data) /* {{{ */ { int status = 0; + curl_easy_setopt(cb->curl, CURLOPT_URL, cb->location); curl_easy_setopt(cb->curl, CURLOPT_POSTFIELDS, data); status = curl_easy_perform(cb->curl); @@ -163,7 +164,6 @@ static int wh_callback_init(wh_callback_t *cb) /* {{{ */ curl_easy_setopt(cb->curl, CURLOPT_HTTPHEADER, cb->headers); curl_easy_setopt(cb->curl, CURLOPT_ERRORBUFFER, cb->curl_errbuf); - curl_easy_setopt(cb->curl, CURLOPT_URL, cb->location); curl_easy_setopt(cb->curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(cb->curl, CURLOPT_MAXREDIRS, 50L); @@ -390,6 +390,9 @@ static int wh_write_command(const data_set_t *ds, } assert(command_len < cb->send_buffer_free); + /* Make scan-build happy. */ + assert(cb->send_buffer != NULL); + /* `command_len + 1' because `command_len' does not include the * trailing null byte. Neither does `send_buffer_fill'. */ memcpy(cb->send_buffer + cb->send_buffer_fill, command, command_len + 1);