From 7c4dd917908d109c155f7a5e88b4adc7c9067bca Mon Sep 17 00:00:00 2001 From: yanghao Date: Thu, 10 Aug 2023 09:34:58 +0800 Subject: [PATCH] Fix connection timeout or failure memory leak --- lib/init.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/init.c b/lib/init.c index 2fc71c63..652e38cd 100644 --- a/lib/init.c +++ b/lib/init.c @@ -350,7 +350,11 @@ void smb2_destroy_context(struct smb2_context *smb2) if (smb2->dirs) { smb2_free_all_dirs(smb2); } - + if (smb2->connect_cb) { + smb2->connect_cb(smb2, SMB2_STATUS_CANCELLED, + NULL, smb2->connect_data); + smb2->connect_cb = NULL; + } free(smb2->session_key); smb2->session_key = NULL;