[ML][Single] Fix the crash issue in SingleShot class 45/287545/1 accepted/tizen/7.0/unified/20230201.173115 accepted/tizen/7.0/unified/20230208.184457 accepted/tizen/7.0/unified/20230208.231224 accepted/tizen/7.0/unified/20230208.231243
authorSangjung Woo <sangjung.woo@samsung.com>
Thu, 26 Jan 2023 07:46:02 +0000 (16:46 +0900)
committerPiotr Kosko <p.kosko@samsung.com>
Tue, 31 Jan 2023 07:46:11 +0000 (07:46 +0000)
commitccf98d263fc3fef6d986d6cbf7d2389c1698b0ab
treea33acedd6a7cce8cf25a7cd79784df3b3474e8e7
parent1b780cd40b0c569b3a11bb86a4c1e2afa4c7cbfd
[ML][Single] Fix the crash issue in SingleShot class

ml_single_close() can be called in both Close() method and destructor of
SingleShot class. If the handle is invalid, calling ml_single_close()
can cause the segmentation fault issue. This patch checks whether the
handle is valid or not so it fixes the potential bug.

Change-Id: I0ab94cae99f53d274a091acb3a21403f42664439
Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
(cherry picked from commit d5acf81c3ac03c00e66a6398e1ae10a4c27f08c9)
src/ml/ml_singleshot.cc