From 30c2e4576eb3859aff36bf8e7be957337152c366 Mon Sep 17 00:00:00 2001 From: Uri Simchoni Date: Sun, 18 Sep 2016 11:05:23 +0300 Subject: [PATCH] smbd: free talloc context if no quota records are available When generating a list of user quota records, free the memory context that controls this list if the list is empty. Otherwise, the context remains unreferenced and memory is leaked. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12289 Signed-off-by: Uri Simchoni Reviewed-by: Jeremy Allison (cherry picked from commit 175bc6f1e3442f5cb2258aaadf318ebf23c5d769) --- source3/smbd/ntquotas.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source3/smbd/ntquotas.c b/source3/smbd/ntquotas.c index 93f4a2a..4acfa50 100644 --- a/source3/smbd/ntquotas.c +++ b/source3/smbd/ntquotas.c @@ -226,6 +226,9 @@ int vfs_get_user_ntquota_list(files_struct *fsp, SMB_NTQUOTA_LIST **qt_list) } endpwent(); + if (*qt_list == NULL) { + TALLOC_FREE(mem_ctx); + } return 0; } -- 2.5.5