diff --git a/NEWS b/NEWS index f706192b..b907919e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +This release includes the following changes: + + o Added libssh2_free() + libssh2 1.2.7 (August 17, 2010) This release includes the following changes: diff --git a/include/libssh2.h b/include/libssh2.h index 6040ab81..9d1e565d 100644 --- a/include/libssh2.h +++ b/include/libssh2.h @@ -420,6 +420,13 @@ LIBSSH2_API int libssh2_init(int flags); */ LIBSSH2_API void libssh2_exit(void); +/* + * libssh2_free() + * + * Deallocate memory allocated by earlier call to libssh2 functions. + */ +LIBSSH2_API void libssh2_free(LIBSSH2_SESSION *session, void *ptr) + /* Session API */ LIBSSH2_API LIBSSH2_SESSION * libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)), diff --git a/src/misc.c b/src/misc.c index 7a924922..8809b6bc 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1,5 +1,6 @@ /* Copyright (c) 2004-2007 Sara Golemon * Copyright (c) 2009 by Daniel Stenberg + * Copyright (c) 2010 Simon Josefsson * All rights reserved. * * Redistribution and use in source and binary forms, @@ -352,6 +353,12 @@ size_t _libssh2_base64_encode(LIBSSH2_SESSION *session, } /* ---- End of Base64 Encoding ---- */ +LIBSSH2_API void +libssh2_free(LIBSSH2_SESSION *session, void *ptr) +{ + LIBSSH2_FREE(session, ptr); +} + #ifdef LIBSSH2DEBUG LIBSSH2_API int libssh2_trace(LIBSSH2_SESSION * session, int bitmask)