Skip to content
Snippets Groups Projects
Commit d46b006f authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

add_buffer_send() free()d the buffer *before* it was used! :-O

parent 033263e6
No related branches found
No related tags found
No related merge requests found
......@@ -194,17 +194,20 @@ send_buffer *add_buffer_init(void)
*/
size_t add_buffer_send(int sockfd, struct connectdata *conn, send_buffer *in)
{
if(in->buffer)
free(in->buffer);
free(in);
size_t amount;
if(conn->data->bits.verbose) {
fputs("> ", conn->data->err);
/* this data _may_ contain binary stuff */
fwrite(in->buffer, in->size_used, 1, conn->data->err);
}
return ssend(sockfd, conn, in->buffer, in->size_used);
amount = ssend(sockfd, conn, in->buffer, in->size_used);
if(in->buffer)
free(in->buffer);
free(in);
return amount;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment