service: graph: Set graph handle to NULL after free
Graph_handle is not set to NULL after free at different places.
This leads to memory access to freed memory. Set graph_handle to
NULL to fix the issue.
Change-Id: I7d3fd756ab32bf1894a5466762dccecc17c51515
diff --git a/service/src/session_obj.c b/service/src/session_obj.c
index 3b681f4..8052859 100644
--- a/service/src/session_obj.c
+++ b/service/src/session_obj.c
@@ -774,10 +774,12 @@
goto done;
graph_cleanup:
- if (opened_count == 0)
+ if (opened_count == 0) {
graph_close(sess_obj->graph);
- else
+ sess_obj->graph = NULL;
+ } else {
graph_remove(sess_obj->graph, merged_metadata);
+ }
close_device:
if (aif_obj->params) {
@@ -921,6 +923,7 @@
graph_cleanup:
graph_close(sess_obj->graph);
+ sess_obj->graph = NULL;
done:
return ret;
}