Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f1fbe42 authored by Arun Kumar Neelakantam's avatar Arun Kumar Neelakantam
Browse files

trace: ipc_logging: Fix memory leak of "struct dfunc_info"



Memory allocated during context created is not getting freed
while context destroyed.

Free the "struct dfunc_info" memory while context destroy.

CRs-Fixed: 2319209
Change-Id: I472c09e147d5bc109745176601b329616d5be111
Signed-off-by: default avatarArun Kumar Neelakantam <aneela@codeaurora.org>
parent c73cdda4
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -925,6 +925,7 @@ void ipc_log_context_free(struct kref *kref)
int ipc_log_context_destroy(void *ctxt)
{
	struct ipc_log_context *ilctxt = (struct ipc_log_context *)ctxt;
	struct dfunc_info *df_info = NULL, *tmp = NULL;
	unsigned long flags;

	if (!ilctxt)
@@ -935,6 +936,10 @@ int ipc_log_context_destroy(void *ctxt)
	spin_lock(&ilctxt->context_lock_lhb1);
	ilctxt->destroyed = true;
	complete_all(&ilctxt->read_avail);
	list_for_each_entry_safe(df_info, tmp, &ilctxt->dfunc_info_list, list) {
		list_del(&df_info->list);
		kfree(df_info);
	}
	spin_unlock(&ilctxt->context_lock_lhb1);

	write_lock_irqsave(&context_list_lock_lha1, flags);