1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

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

This commit is contained in:
Daniel Stenberg 2000-10-03 16:53:41 +00:00
parent 033263e696
commit d46b006f22

View File

@ -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;
}