summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-06-30 13:41:34 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-06-30 15:19:39 -0400
commitf89f2f91cc3ff455041b1ca887904e860de6c896 (patch)
treebf7c9d879e9c1fec3ec340eae1ae91536eb44eab /server
parent293bb31f2747b402ce39152497facd42a5593f9c (diff)
downloadsssd-f89f2f91cc3ff455041b1ca887904e860de6c896.tar.gz
sssd-f89f2f91cc3ff455041b1ca887904e860de6c896.tar.xz
sssd-f89f2f91cc3ff455041b1ca887904e860de6c896.zip
Eliminate segfault on first start-up
There was a typo in the confdb setup portion of the monitor_process_init that was attempting to use the wrong cdb object to initialize. This patch also adds some missing talloc_free() calls on error.
Diffstat (limited to 'server')
-rw-r--r--server/monitor/monitor.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c
index 5cc73c8b8..2a444dc6f 100644
--- a/server/monitor/monitor.c
+++ b/server/monitor/monitor.c
@@ -1414,6 +1414,7 @@ int monitor_process_init(TALLOC_CTX *mem_ctx,
cdb_file = talloc_asprintf(ctx, "%s/%s", DB_PATH, CONFDB_FILE);
if (cdb_file == NULL) {
DEBUG(0,("Out of memory, aborting!\n"));
+ talloc_free(ctx);
return ENOMEM;
}
@@ -1421,20 +1422,24 @@ int monitor_process_init(TALLOC_CTX *mem_ctx,
ret = confdb_init(ctx, ctx->ev, &ctx->cdb, cdb_file);
if (ret != EOK) {
DEBUG(0,("The confdb initialization failed\n"));
+ talloc_free(ctx);
return ret;
}
/* Load special entries */
- ret = confdb_create_base(cdb);
+ ret = confdb_create_base(ctx->cdb);
if (ret != EOK) {
talloc_free(ctx);
return ret;
}
+ } else if (ret != EOK) {
+ DEBUG(0, ("Fatal error initializing confdb\n"));
+ talloc_free(ctx);
+ return ret;
}
- ret = confdb_init_db(config_file, cdb);
+ ret = confdb_init_db(config_file, ctx->cdb);
if (ret != EOK) {
- talloc_free(cdb);
DEBUG(0, ("ConfDB initialization has failed [%s]\n",
strerror(ret)));
talloc_free(ctx);
@@ -1443,12 +1448,17 @@ int monitor_process_init(TALLOC_CTX *mem_ctx,
/* Read in the monitor's configuration */
ret = get_monitor_config(ctx);
- if (ret != EOK)
+ if (ret != EOK) {
+ talloc_free(ctx);
return ret;
+ }
/* Watch for changes to the confdb config file */
ret = monitor_config_file(ctx, cdb, event_ctx, config_file, monitor_signal_reconf, ctx);
- if (ret != EOK) return ret;
+ if (ret != EOK) {
+ talloc_free(ctx);
+ return ret;
+ }
/* Avoid a startup race condition between InfoPipe
* and NSS. If the sysdb doesn't exist yet, both
@@ -1458,8 +1468,10 @@ int monitor_process_init(TALLOC_CTX *mem_ctx,
*/
ret = sysdb_init(mem_ctx, ctx->ev, ctx->cdb,
NULL, &sysdb);
- if (ret != EOK)
+ if (ret != EOK) {
+ talloc_free(ctx);
return ret;
+ }
talloc_free(sysdb);
/* Initialize D-BUS Server
@@ -1467,6 +1479,7 @@ int monitor_process_init(TALLOC_CTX *mem_ctx,
* SSSD processes */
ret = monitor_dbus_init(ctx);
if (ret != EOK) {
+ talloc_free(ctx);
return ret;
}