memerror in uid-get. reinsert save config yang spec (removed for wrong reasons previously causing memleaks)
This commit is contained in:
parent
69b27f3280
commit
c4954f5c43
9 changed files with 83 additions and 15 deletions
|
|
@ -109,6 +109,8 @@ backend_terminate(clicon_handle h)
|
|||
xml_free(x);
|
||||
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
||||
yspec_free(yspec);
|
||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
||||
yspec_free(yspec);
|
||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||
cvec_free(nsctx);
|
||||
if ((x = clicon_nacm_ext(h)) != NULL)
|
||||
|
|
@ -507,7 +509,7 @@ main(int argc,
|
|||
clicon_log_init(__PROGRAM__, debug?LOG_DEBUG:LOG_INFO, logdst);
|
||||
clicon_debug_init(debug, NULL);
|
||||
|
||||
/* Create configure yang-spec */
|
||||
/* Create configure yang-spec (note different from dbspec holding application specs) */
|
||||
if ((yspecfg = yspec_new()) == NULL)
|
||||
goto done;
|
||||
|
||||
|
|
@ -517,6 +519,9 @@ main(int argc,
|
|||
usage(h, argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (clicon_config_yang_set(h, yspecfg) < 0)
|
||||
goto done;
|
||||
|
||||
/* External NACM file? */
|
||||
nacm_mode = clicon_option_str(h, "CLICON_NACM_MODE");
|
||||
if (nacm_mode && strcmp(nacm_mode, "external") == 0)
|
||||
|
|
|
|||
|
|
@ -270,10 +270,12 @@ backend_accept_client(int fd,
|
|||
#error "Need getsockopt O_PEERCRED or getpeereid for unix socket peer cred"
|
||||
#endif
|
||||
if (name != NULL){
|
||||
if ((ce->ce_username = strdup(name)) == NULL){
|
||||
if ((ce->ce_username = name) == NULL){
|
||||
clicon_err(OE_UNIX, errno, "strdup");
|
||||
name = NULL;
|
||||
goto done;
|
||||
}
|
||||
name = NULL;
|
||||
}
|
||||
break;
|
||||
case AF_INET:
|
||||
|
|
@ -291,5 +293,7 @@ backend_accept_client(int fd,
|
|||
goto done;
|
||||
retval = 0;
|
||||
done:
|
||||
if (name)
|
||||
free(name);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,6 +169,8 @@ cli_terminate(clicon_handle h)
|
|||
clicon_rpc_close_session(h);
|
||||
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
||||
yspec_free(yspec);
|
||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
||||
yspec_free(yspec);
|
||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||
cvec_free(nsctx);
|
||||
if ((x = clicon_conf_xml(h)) != NULL)
|
||||
|
|
@ -350,7 +352,7 @@ main(int argc, char **argv)
|
|||
|
||||
clicon_debug_init(debug, NULL);
|
||||
|
||||
/* Create top-level yang spec and store as option */
|
||||
/* Create configure yang-spec (note different from dbspec holding application specs) */
|
||||
if ((yspecfg = yspec_new()) == NULL)
|
||||
goto done;
|
||||
/* Find and read configfile */
|
||||
|
|
@ -359,6 +361,9 @@ main(int argc, char **argv)
|
|||
usage(h, argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (clicon_config_yang_set(h, yspecfg) < 0)
|
||||
goto done;
|
||||
|
||||
/* Now rest of options */
|
||||
opterr = 0;
|
||||
optind = 1;
|
||||
|
|
|
|||
|
|
@ -331,6 +331,8 @@ netconf_terminate(clicon_handle h)
|
|||
clicon_rpc_close_session(h);
|
||||
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
||||
yspec_free(yspec);
|
||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
||||
yspec_free(yspec);
|
||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||
cvec_free(nsctx);
|
||||
if ((x = clicon_conf_xml(h)) != NULL)
|
||||
|
|
@ -441,12 +443,15 @@ main(int argc,
|
|||
clicon_log_init(__PROGRAM__, debug?LOG_DEBUG:LOG_INFO, logdst);
|
||||
clicon_debug_init(debug, NULL);
|
||||
|
||||
/* Create configure yang-spec */
|
||||
/* Create configure yang-spec (note different from dbspec holding application specs) */
|
||||
if ((yspecfg = yspec_new()) == NULL)
|
||||
goto done;
|
||||
/* Find and read configfile */
|
||||
if (clicon_options_main(h, yspecfg) < 0)
|
||||
return -1;
|
||||
if (clicon_config_yang_set(h, yspecfg) < 0)
|
||||
goto done;
|
||||
|
||||
/* Now rest of options */
|
||||
optind = 1;
|
||||
opterr = 0;
|
||||
|
|
|
|||
|
|
@ -605,6 +605,8 @@ restconf_terminate(clicon_handle h)
|
|||
clicon_rpc_close_session(h);
|
||||
if ((yspec = clicon_dbspec_yang(h)) != NULL)
|
||||
yspec_free(yspec);
|
||||
if ((yspec = clicon_config_yang(h)) != NULL)
|
||||
yspec_free(yspec);
|
||||
if ((nsctx = clicon_nsctx_global_get(h)) != NULL)
|
||||
cvec_free(nsctx);
|
||||
if ((x = clicon_conf_xml(h)) != NULL)
|
||||
|
|
|
|||
|
|
@ -642,12 +642,15 @@ main(int argc,
|
|||
goto done;
|
||||
}
|
||||
|
||||
/* Create configure yang-spec */
|
||||
/* Create configure yang-spec note different from dbspec holding application specs) */
|
||||
if ((yspecfg = yspec_new()) == NULL)
|
||||
goto done;
|
||||
/* Find and read configfile */
|
||||
if (clicon_options_main(h, yspecfg) < 0)
|
||||
goto done;
|
||||
if (clicon_config_yang_set(h, yspecfg) < 0)
|
||||
goto done;
|
||||
|
||||
stream_path = clicon_option_str(h, "CLICON_STREAM_PATH");
|
||||
/* Now rest of options, some overwrite option file */
|
||||
optind = 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue