platform: msm_shared: free smd channel if it is not NULL
smd channel should be freed only if it is not NULL.
Change-Id: I0cb417e0bec198303429bbbc55dbe17f6aa7b824
diff --git a/platform/msm_shared/smd.c b/platform/msm_shared/smd.c
index 6ead08e..7ebbcbd 100644
--- a/platform/msm_shared/smd.c
+++ b/platform/msm_shared/smd.c
@@ -433,7 +433,11 @@
if(ch->current_state == SMD_SS_CLOSED)
{
flush_smd_channel_entries();
- free(smd_channel_alloc_entry);
+ if(smd_channel_alloc_entry)
+ {
+ free(smd_channel_alloc_entry);
+ smd_channel_alloc_entry = NULL;
+ }
event_signal(&smd_closed, false);
return INT_NO_RESCHEDULE;
}