From 11676d95c5e92828c81a4d36121ad5b640090fbc Mon Sep 17 00:00:00 2001 From: Parichay Kapoor Date: Mon, 10 Feb 2020 15:01:32 +0900 Subject: [PATCH] [single/coverity] Fix coverity issue Fix coverity issue CWE-416 Issue: In ml_single_set_info_in_handle: A pointer to freed memory is dereferenced, used as a function argument, or otherwise used Signed-off-by: Parichay Kapoor --- api/capi/src/nnstreamer-capi-single.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/capi/src/nnstreamer-capi-single.c b/api/capi/src/nnstreamer-capi-single.c index 098d561..082cae5 100644 --- a/api/capi/src/nnstreamer-capi-single.c +++ b/api/capi/src/nnstreamer-capi-single.c @@ -382,9 +382,9 @@ ml_single_set_info_in_handle (ml_single_h single, gboolean is_input, if (tensors_info && !ml_tensors_info_is_equal (tensors_info, info)) { /* given input info is not matched with configured */ + ml_tensors_info_destroy (info); if (is_input) { /* try to update tensors info */ - ml_tensors_info_destroy (info); if (ml_single_update_info (single, tensors_info, &info) != ML_ERROR_NONE) goto done; } else { @@ -393,6 +393,7 @@ ml_single_set_info_in_handle (ml_single_h single, gboolean is_input, } ml_tensors_info_clone (dest, info); + ml_tensors_info_destroy (info); } else if (tensors_info) { ml_single_set_inout_tensors_info (filter_obj, is_input, tensors_info); ml_tensors_info_clone (dest, tensors_info); @@ -401,7 +402,6 @@ ml_single_set_info_in_handle (ml_single_h single, gboolean is_input, is_valid = ml_tensors_info_is_valid (dest); done: - ml_tensors_info_destroy (info); return is_valid; } -- 2.7.4