aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-10-03 16:53:41 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-10-03 16:53:41 +0000
commitd46b006f22031af78e55830b3e359d3576d273fa (patch)
treec87bcd8fe2fafb91debed8f9e61eda16042ce763
parent033263e6962d23e8401df5a3c1a8f0249ce06ebe (diff)
add_buffer_send() free()d the buffer *before* it was used! :-O
-rw-r--r--lib/sendf.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/sendf.c b/lib/sendf.c
index 8042ac8b9..723acc481 100644
--- a/lib/sendf.c
+++ b/lib/sendf.c
@@ -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;
}