[PATCH 2/4] ksmbd-tools: Fix memory leak in lsarpc_lookup_names3_invoke

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If usm_lookup_user() fails, the "ni" struct is leaked.

Signed-off-by: Marios Makassikis <mmakassikis@xxxxxxxxxx>
---
 mountd/rpc_lsarpc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mountd/rpc_lsarpc.c b/mountd/rpc_lsarpc.c
index cc99a147b239..b9088950c46e 100644
--- a/mountd/rpc_lsarpc.c
+++ b/mountd/rpc_lsarpc.c
@@ -357,8 +357,10 @@ static int lsarpc_lookup_names3_invoke(struct ksmbd_rpc_pipe *pipe)
 		}
 
 		ni->user = usm_lookup_user(name);
-		if (!ni->user)
+		if (!ni->user) {
+			free(ni);
 			break;
+		}
 		pipe->entries = g_array_append_val(pipe->entries, ni);
 		pipe->num_entries++;
 		smb_init_domain_sid(&ni->sid);
-- 
2.25.1




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux