smbd: free talloc context if no quota records are available
[metze/samba/wip.git] / source3 / smbd / ntquotas.c
index 9b2e39a72bf8e1e0d702f693202fcd5268388fb9..4acfa5057ed0201f17271c08d7bb0e742d8a2b95 100644 (file)
@@ -226,13 +226,15 @@ 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;
 }
 
 static int quota_handle_destructor(SMB_NTQUOTA_HANDLE *handle)
 {
-       if (handle->quota_list)
-               free_ntquota_list(&handle->quota_list);
+       free_ntquota_list(&handle->quota_list);
        return 0;
 }