Add function ssl_FreeDecodeBuffer() to release the sniffer allocated data buffer and reset the pointer.
This commit is contained in:
parent
b05332c417
commit
a42308e28a
@ -3229,6 +3229,21 @@ int ssl_DecodePacket(const byte* packet, int length, byte** data, char* error)
|
||||
}
|
||||
|
||||
|
||||
/* Deallocator for the decoded data buffer. */
|
||||
/* returns 0 on success, -1 on error */
|
||||
int ssl_FreeDecodeBuffer(byte** data, char* error)
|
||||
{
|
||||
(void)error;
|
||||
|
||||
if (data != NULL) {
|
||||
free(*data);
|
||||
*data = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Enables (if traceFile)/ Disables debug tracing */
|
||||
/* returns 0 on success, -1 on error */
|
||||
int ssl_Trace(const char* traceFile, char* error)
|
||||
|
@ -313,8 +313,7 @@ int main(int argc, char** argv)
|
||||
if (ret > 0) {
|
||||
data[ret] = 0;
|
||||
printf("SSL App Data(%d:%d):%s\n", packetNumber, ret, data);
|
||||
free(data);
|
||||
data = NULL;
|
||||
ssl_FreeDecodeBuffer(&data, err);
|
||||
}
|
||||
}
|
||||
else if (saveFile)
|
||||
|
@ -58,6 +58,9 @@ WOLFSSL_API
|
||||
SSL_SNIFFER_API int ssl_DecodePacket(const unsigned char* packet, int length,
|
||||
unsigned char** data, char* error);
|
||||
|
||||
WOLFSSL_API
|
||||
SSL_SNIFFER_API int ssl_FreeDecodeBuffer(unsigned char** data, char* error);
|
||||
|
||||
WOLFSSL_API
|
||||
SSL_SNIFFER_API int ssl_Trace(const char* traceFile, char* error);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user