From 7beacb49f8b35b686aa9fe4b812b264fe0cb109b Mon Sep 17 00:00:00 2001 From: rswindell <> Date: Tue, 24 Mar 2009 09:34:28 +0000 Subject: [PATCH] Created smb_freehashes() for modules outside of smblib (e.g. other DLLs) to free the results of smb_msghashes(). --- src/smblib/smbhash.c | 9 ++++++++- src/smblib/smblib.h | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/smblib/smbhash.c b/src/smblib/smbhash.c index 389d51a053..f80976170a 100644 --- a/src/smblib/smbhash.c +++ b/src/smblib/smbhash.c @@ -8,7 +8,7 @@ * @format.tab-size 4 (Plain Text/Source Code File Header) * * @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) * * * - * Copyright 2008 Rob Swindell - http://www.synchro.net/copyright.html * + * Copyright 2009 Rob Swindell - http://www.synchro.net/copyright.html * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public License * @@ -267,6 +267,13 @@ hash_t** SMBCALL smb_msghashes(smbmsg_t* msg, const uchar* body) return(hashes); } +void SMBCALL smb_freehashes(hash_t** hashes) +{ + size_t n; + + FREE_LIST(hashes,n); +} + /* Calculates and stores the hashes for a single message */ int SMBCALL smb_hashmsg(smb_t* smb, smbmsg_t* msg, const uchar* text, BOOL update) { diff --git a/src/smblib/smblib.h b/src/smblib/smblib.h index 4fe74eae3a..6ae52594cc 100644 --- a/src/smblib/smblib.h +++ b/src/smblib/smblib.h @@ -186,6 +186,7 @@ SMBEXPORT hash_t** SMBCALL smb_msghashes(smbmsg_t* msg, const uchar* text); SMBEXPORT int SMBCALL smb_addhashes(smb_t* smb, hash_t** hash_list, BOOL skip_marked); SMBEXPORT uint16_t SMBCALL smb_name_crc(const char* name); SMBEXPORT uint16_t SMBCALL smb_subject_crc(const char *subj); +SMBEXPORT void SMBCALL smb_freehashes(hash_t**); /* Fast look-up functions (using hashes) */ SMBEXPORT int SMBCALL smb_getmsgidx_by_hash(smb_t* smb, smbmsg_t* msg, unsigned source -- GitLab