summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/libsmb/libsmb_dir.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index 9939e25fb5..c0c6e83bb6 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -518,6 +518,10 @@ SMBC_opendir_ctx(SMBCCTX *context,
ip_list = (struct ip_service *)memdup(
&server_addr, sizeof(server_addr));
if (ip_list == NULL) {
+ if (dir) {
+ SAFE_FREE(dir->fname);
+ SAFE_FREE(dir);
+ }
TALLOC_FREE(frame);
errno = ENOMEM;
return NULL;