From 7cbd55c6c3c18634e939b1ca0746ef4768fdfe8a Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Wed, 29 Apr 2009 21:26:00 +0200 Subject: [PATCH 1/1] [client] Dynamically allocate output buffer. This should simplify subsequent patches that allow variable-sized output buffers for filters/receivers. --- client.h | 2 +- client_common.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/client.h b/client.h index a7a3289b..c6d5c75d 100644 --- a/client.h +++ b/client.h @@ -58,7 +58,7 @@ struct client_task { /** the client task structure */ struct task task; /** the buffer used for handshake and receiving */ - char buf[CLIENT_BUFSIZE]; + char *buf; /** number of bytes loaded in \p buf */ size_t loaded; /** non-zero if the pre_select hook added \p fd to the read fd set */ diff --git a/client_common.c b/client_common.c index c1e23f7a..5bce7fb4 100644 --- a/client_common.c +++ b/client_common.c @@ -64,6 +64,7 @@ void client_close(struct client_task *ct) disable_crypt(ct->fd); close(ct->fd); } + free(ct->buf); free(ct->user); free(ct->config_file); free(ct->key_file); @@ -327,6 +328,7 @@ int client_open(int argc, char *argv[], struct client_task **ct_ptr, int ret; struct client_task *ct = para_calloc(sizeof(struct client_task)); + ct->buf = para_malloc(CLIENT_BUFSIZE); *ct_ptr = ct; ct->fd = -1; ret = -E_CLIENT_SYNTAX; -- 2.39.2