From: Uri Simchoni Date: Sun, 18 Sep 2016 08:05:23 +0000 (+0300) Subject: smbd: free talloc context if no quota records are available X-Git-Url: http://git.samba.org/?p=metze%2Fsamba%2Fwip.git;a=commitdiff_plain;h=175bc6f1e3442f5cb2258aaadf318ebf23c5d769 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 --- diff --git a/source3/smbd/ntquotas.c b/source3/smbd/ntquotas.c index 93f4a2ae12fe..4acfa5057ed0 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; }