Fixed memory leaks at -V

This commit is contained in:
Olof hagsand 2024-02-18 22:42:12 +01:00
parent 8f2601bfdf
commit 9bc60abe2e
6 changed files with 11 additions and 7 deletions

View file

@ -846,7 +846,7 @@ main(int argc,
if (print_version){
if (clixon_plugin_version_all(h, stdout) < 0)
goto done;
exit(0);
goto ok;
}
/* Load Yang modules
* 1. Load a yang module as a specific absolute filename */

View file

@ -786,7 +786,8 @@ main(int argc,
if (print_version){
if (clixon_plugin_version_all(h, stdout) < 0)
goto done;
exit(0);
retval = 0;
goto done;
}
/* Add (hardcoded) netconf features in case ietf-netconf loaded here
* Otherwise it is loaded in netconf_module_load below

View file

@ -876,7 +876,7 @@ main(int argc,
if (print_version){
if (clixon_plugin_version_all(h, stdout) < 0)
goto done;
exit(0);
goto ok;
}
/* Load Yang modules
* 1. Load a yang module as a specific absolute filename */

View file

@ -503,7 +503,7 @@ main(int argc,
if (print_version){
if (clixon_plugin_version_all(h, stdout) < 0)
goto done;
exit(0);
goto ok;
}
/* Create a pseudo-plugin to create extension callback to set the ietf-routing
* yang-data extension for api-root top-level restconf function.

View file

@ -961,7 +961,7 @@ restconf_clixon_init(clixon_handle h,
if (print_version){
if (clixon_plugin_version_all(h, stdout) < 0)
goto done;
exit(0);
goto ok;
}
/* Create a pseudo-plugin to create extension callback to set the ietf-routing
* yang-data extension for api-root top-level restconf function.
@ -1068,6 +1068,7 @@ restconf_clixon_init(clixon_handle h,
if (ret == 0)
goto fail;
}
ok:
retval = 1;
done:
if (xerr)

View file

@ -358,6 +358,7 @@ main(int argc,
int zap = 0;
int config_dump = 0;
enum format_enum config_dump_format = FORMAT_XML;
int print_version = 0;
/* Create handle */
if ((h = clixon_handle_init()) == NULL)
@ -382,7 +383,7 @@ main(int argc,
break;
case 'V': /* version */
cligen_output(stdout, "Clixon version: %s\n", CLIXON_VERSION_STRING);
exit(0);
print_version++; /* plugins may also print versions w ca-version callback */
break;
case 'D' : { /* debug */
int d = 0;
@ -408,7 +409,8 @@ main(int argc,
goto done;
break;
}
if (print_version)
goto ok;
/*
* Logs, error and debug to stderr or syslog, set debug level
*/