Fixed memory errors in backend, cli and streams

This commit is contained in:
Olof hagsand 2025-01-29 22:40:31 +01:00
parent fc3f0cbcd9
commit d24d5f6a9c
6 changed files with 33 additions and 37 deletions

View file

@ -167,7 +167,6 @@ clixon_handle_exit(clixon_handle h)
clicon_hash_free(ha);
if ((ha = clicon_db_elmnt(h)) != NULL)
clicon_hash_free(ha);
stream_delete_all(h, 1);
free(ch);
retval = 0;
return retval;

View file

@ -181,8 +181,9 @@ stream_add(clixon_handle h,
/*! Delete complete notification event stream list (not just single stream)
*
* @param[in] h Clixon handle
* @param[in] force Force deletion of
* @retval 0 OK
* @param[in] force Also free ss
* @retval 0 OK
* @retval -1 Error
*/
int
stream_delete_all(clixon_handle h,
@ -395,20 +396,20 @@ stream_ss_add(clixon_handle h,
return NULL;
}
/*! Delete event stream subscription to a stream given a callback and arg
/*! Delete event stream subscription
*
* @param[in] h Clixon handle
* @param[in] stream Name of stream or NULL for all streams
* @param[in] fn Callback when event occurs
* @param[in] arg Argument to use with callback. Also handle when deleting
* @param[in] es Event stream
* @param[in] ss Stream subscription
* @param[in] force 1: free ss
* @retval 0 OK
* @retval -1 Error
*/
int
stream_ss_rm(clixon_handle h,
event_stream_t *es,
struct stream_subscription *ss,
int force)
stream_ss_rm(clixon_handle h,
event_stream_t *es,
struct stream_subscription *ss,
int force)
{
clixon_debug(CLIXON_DBG_STREAM, "");
DELQ(ss, es->es_subscription, struct stream_subscription *);

View file

@ -960,7 +960,7 @@ yspec_new_shared(clixon_handle h,
yang_flag_set(yspec1, YANG_FLAG_SPEC_MOUNT);
clixon_debug(CLIXON_DBG_YANG, "new yang-spec: %p", yspec1);
}
if (yang_cvec_add(yspec1, CGV_STRING, xpath) < 0){
if (yang_cvec_add(yspec1, CGV_STRING, xpath) == NULL){
yspec1 = NULL;
goto done;
}
@ -1102,7 +1102,6 @@ ys_free1(yang_stmt *ys,
free(ys->ys_nscache);
break;
#endif
default:
break;
}