Fixed memory leak in new candidate_validate function
Added error returns for clixon-lib process rpc empty returns
This commit is contained in:
parent
cb469a2bc7
commit
ba45d6d2a1
3 changed files with 57 additions and 45 deletions
|
|
@ -612,20 +612,27 @@ candidate_validate(clicon_handle h,
|
|||
* use clicon_err. */
|
||||
if (xret && clicon_xml2cbuf(cbret, xret, 0, 0, -1) < 0)
|
||||
goto done;
|
||||
plugin_transaction_abort_all(h, td);
|
||||
if (!cbuf_len(cbret) &&
|
||||
netconf_operation_failed(cbret, "application", clicon_err_reason)< 0)
|
||||
goto done;
|
||||
goto fail;
|
||||
}
|
||||
if (xmldb_get0_clear(h, td->td_src) < 0 ||
|
||||
xmldb_get0_clear(h, td->td_target) < 0){
|
||||
plugin_transaction_abort_all(h, td);
|
||||
xmldb_get0_clear(h, td->td_target) < 0)
|
||||
goto done;
|
||||
}
|
||||
|
||||
plugin_transaction_end_all(h, td);
|
||||
retval = 1;
|
||||
done:
|
||||
if (xret)
|
||||
xml_free(xret);
|
||||
if (td){
|
||||
if (retval < 1)
|
||||
plugin_transaction_abort_all(h, td);
|
||||
xmldb_get0_free(h, &td->td_target);
|
||||
xmldb_get0_free(h, &td->td_src);
|
||||
transaction_free(td);
|
||||
}
|
||||
return retval;
|
||||
fail:
|
||||
retval = 0;
|
||||
|
|
|
|||
|
|
@ -270,11 +270,11 @@ restconf_pseudo_process_control(clicon_handle h)
|
|||
* see restconf_pseudo_set_log which sets flag when process starts
|
||||
*/
|
||||
argv[i++] = "-D";
|
||||
argv[i++] = strdup("0");
|
||||
argv[i++] = "0";
|
||||
argv[i++] = "-l";
|
||||
argv[i++] = strdup("s"); /* There is also log-destination in clixon-restconf.yang */
|
||||
argv[i++] = "s"; /* There is also log-destination in clixon-restconf.yang */
|
||||
argv[i++] = "-R";
|
||||
argv[i++] = strdup("");
|
||||
argv[i++] = "";
|
||||
argv[i++] = NULL;
|
||||
assert(i==nr);
|
||||
if (clixon_process_register(h, RESTCONF_PROCESS,
|
||||
|
|
|
|||
|
|
@ -682,9 +682,9 @@ clixon_process_status(clicon_handle h,
|
|||
int run;
|
||||
int i;
|
||||
char timestr[28];
|
||||
int match = 0;
|
||||
|
||||
if (_proc_entry_list == NULL)
|
||||
goto ok;
|
||||
if (_proc_entry_list != NULL){
|
||||
pe = _proc_entry_list;
|
||||
do {
|
||||
if (strcmp(pe->pe_name, name) == 0){
|
||||
|
|
@ -719,11 +719,16 @@ clixon_process_status(clicon_handle h,
|
|||
if (pe->pe_pid)
|
||||
cprintf(cbret, "<pid xmlns=\"%s\">%u</pid>", CLIXON_LIB_NS, pe->pe_pid);
|
||||
cprintf(cbret, "</rpc-reply>");
|
||||
match++;
|
||||
break; /* hit break here */
|
||||
}
|
||||
pe = NEXTQ(process_entry_t *, pe);
|
||||
} while (pe != _proc_entry_list);
|
||||
ok:
|
||||
}
|
||||
if (!match){ /* No match, return error */
|
||||
if (netconf_unknown_element(cbret, "application", (char*)name, "Process service is not known") < 0)
|
||||
goto done;
|
||||
}
|
||||
retval = 0;
|
||||
done:
|
||||
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue