Fixes after coverity static analysis

This commit is contained in:
Olof hagsand 2024-03-03 17:05:36 +01:00
parent d94b4f5b7c
commit a1badc312e
24 changed files with 148 additions and 70 deletions

View file

@ -129,6 +129,7 @@ cli_auto_edit(clixon_handle h,
char *str;
char *mtpoint = NULL;
yang_stmt *yspec0;
char *mtpoint2 = NULL;
if (cvec_len(argv) != 2 && cvec_len(argv) != 3){
clixon_err(OE_PLUGIN, EINVAL, "Usage: %s(api_path_fmt>*, <treename>)", __FUNCTION__);
@ -183,7 +184,6 @@ cli_auto_edit(clixon_handle h,
if (clicon_data_set(h, "cli-edit-mode", api_path) < 0)
goto done;
if (mtpoint){
char *mtpoint2;
if ((mtpoint2 = strdup(mtpoint)) == NULL){
clixon_err(OE_UNIX, errno, "strdup");
goto done;
@ -204,6 +204,8 @@ cli_auto_edit(clixon_handle h,
}
retval = 0;
done:
if (mtpoint2)
free(mtpoint2);
if (api_path)
free(api_path);
return retval;

View file

@ -356,6 +356,8 @@ mtpoint_paths(yang_stmt *yspec0,
free(api_path_fmt0);
if (nsc0)
cvec_free(nsc0);
if (xtop0)
xml_free(xtop0);
return retval;
}