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: Arun Kumar Neelakantam <aneela@codeaurora.org>
This commit is contained in:
Arun Kumar Neelakantam 2018-09-21 15:19:09 +05:30 committed by Gerrit - the friendly Code Review server
parent 2f79d07f10
commit 862a3c4dda

View file

@ -895,6 +895,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)
@ -905,6 +906,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);