Memory error in backend transaction revert

This commit is contained in:
Olof Hagsand 2018-08-01 18:34:44 +02:00
parent 656800cdd3
commit 10ada483e5
3 changed files with 10 additions and 7 deletions

View file

@ -15,6 +15,7 @@
* Added -l option for clixon_backend for directing syslog to stderr or stdout if running in foreground * Added -l option for clixon_backend for directing syslog to stderr or stdout if running in foreground
### Corrected Bugs ### Corrected Bugs
* Memory error in backend transaction revert
* Set dir /www-data with www-data as owner, see https://github.com/clicon/clixon/issues/37 * Set dir /www-data with www-data as owner, see https://github.com/clicon/clixon/issues/37
### Known issues ### Known issues

View file

@ -100,7 +100,7 @@ clixon_plugin_reset(clicon_handle h,
if ((resetfn = cp->cp_api.ca_reset) == NULL) if ((resetfn = cp->cp_api.ca_reset) == NULL)
continue; continue;
if ((retval = resetfn(h, db)) < 0) { if ((retval = resetfn(h, db)) < 0) {
clicon_debug(1, "plugin_start() failed\n"); clicon_debug(1, "plugin_start() failed");
return -1; return -1;
} }
break; break;
@ -357,7 +357,7 @@ plugin_transaction_revert(clicon_handle h,
while ((cp = clixon_plugin_each_revert(h, cp, nr)) != NULL) { while ((cp = clixon_plugin_each_revert(h, cp, nr)) != NULL) {
if ((fn = cp->cp_api.ca_trans_commit) == NULL) if ((fn = cp->cp_api.ca_trans_commit) == NULL)
continue; continue;
if ((retval = fn(h, (transaction_data)td)) < 0){ if ((retval = fn(h, (transaction_data)&tr)) < 0){
clicon_log(LOG_NOTICE, "%s: Plugin '%s' trans_commit revert callback failed", clicon_log(LOG_NOTICE, "%s: Plugin '%s' trans_commit revert callback failed",
__FUNCTION__, cp->cp_name); __FUNCTION__, cp->cp_name);
break; break;

View file

@ -130,8 +130,10 @@ clixon_plugin_each_revert(clicon_handle h,
clixon_plugin *cp = NULL; clixon_plugin *cp = NULL;
clixon_plugin *cpnext = NULL; clixon_plugin *cpnext = NULL;
if (cpprev == NULL) if (cpprev == NULL){
if (nr>0)
cpnext = &_clixon_plugins[nr-1]; cpnext = &_clixon_plugins[nr-1];
}
else{ else{
for (i = nr-1; i >= 0; i--) { for (i = nr-1; i >= 0; i--) {
cp = &_clixon_plugins[i]; cp = &_clixon_plugins[i];
@ -320,7 +322,7 @@ clixon_plugin_start(clicon_handle h,
continue; continue;
// optind = 0; // optind = 0;
if (startfn(h, argc, argv) < 0) { if (startfn(h, argc, argv) < 0) {
clicon_debug(1, "plugin_start() failed\n"); clicon_debug(1, "plugin_start() failed");
return -1; return -1;
} }
} }
@ -343,7 +345,7 @@ clixon_plugin_exit(clicon_handle h)
if ((exitfn = cp->cp_api.ca_exit) == NULL) if ((exitfn = cp->cp_api.ca_exit) == NULL)
continue; continue;
if (exitfn(h) < 0) { if (exitfn(h) < 0) {
clicon_debug(1, "plugin_exit() failed\n"); clicon_debug(1, "plugin_exit() failed");
return -1; return -1;
} }
if (dlclose(cp->cp_handle) != 0) { if (dlclose(cp->cp_handle) != 0) {
@ -385,7 +387,7 @@ clixon_plugin_auth(clicon_handle h,
if ((authfn = cp->cp_api.ca_auth) == NULL) if ((authfn = cp->cp_api.ca_auth) == NULL)
continue; continue;
if ((retval = authfn(h, arg)) < 0) { if ((retval = authfn(h, arg)) < 0) {
clicon_debug(1, "plugin_auth() failed\n"); clicon_debug(1, "plugin_auth() failed");
return -1; return -1;
} }
break; break;