From 29b5477849c22f4d8592a2af3a6329913112e1db Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sat, 8 Sep 2018 09:35:20 +0200 Subject: [PATCH] include: Add SSH_BUFFER_FREE Signed-off-by: Andreas Schneider --- include/libssh/libssh.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h index 274491d5..d667dc39 100644 --- a/include/libssh/libssh.h +++ b/include/libssh/libssh.h @@ -795,6 +795,8 @@ LIBSSH_API const char* ssh_get_hmac_out(ssh_session session); LIBSSH_API ssh_buffer ssh_buffer_new(void); LIBSSH_API void ssh_buffer_free(ssh_buffer buffer); +#define SSH_BUFFER_FREE(x) \ + do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0) LIBSSH_API int ssh_buffer_reinit(ssh_buffer buffer); LIBSSH_API int ssh_buffer_add_data(ssh_buffer buffer, const void *data, uint32_t len); LIBSSH_API uint32_t ssh_buffer_get_data(ssh_buffer buffer, void *data, uint32_t requestedlen);