Fixed a negative refcount situation for the config context.
authorGiovanni Giacobbi <johnny@silcnet.org>
Tue, 2 Apr 2002 12:10:13 +0000 (12:10 +0000)
committerGiovanni Giacobbi <johnny@silcnet.org>
Tue, 2 Apr 2002 12:10:13 +0000 (12:10 +0000)
CHANGES
apps/silcd/serverconfig.c

diff --git a/CHANGES b/CHANGES
index 8fbf7f776e969a580f5dcb9e9bf3f88c6a45ccb7..3d78bdbfb6cdb1a7c9508144b194dba0d1c42eea 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -3,6 +3,9 @@ Tue Apr  2 13:39:04 CEST 2002  Johnny Mnemonic <johnny@themnemonic.org>
        * Merged version 1.1.4 of zlib. Even if it not currently in use,
          it's good not to have security holes here.
 
+       * Fixed a negative refcount situtuation for the config context.
+         Affected file is silcd/serverconfig.c.
+
 Mon Apr  1 20:15:10 CEST 2002  Johnny Mnemonic <johnny@themnemonic.org>
 
        * ROBOdoc documented lib/silcutil/silcutil.h.
index 568e19f8e752a9377a34c80eaadd12373ca5d830..b5dbc04ce5a90ba6c885c9202719d725d270f96f 100644 (file)
@@ -1201,6 +1201,7 @@ SilcServerConfig silc_server_config_alloc(const char *filename)
 
   /* alloc a config object */
   config_new = silc_calloc(1, sizeof(*config_new));
+  config_new->refcount = 1;
   if (!config_new)
     return NULL;
 
@@ -1257,7 +1258,6 @@ SilcServerConfig silc_server_config_alloc(const char *filename)
   /* Set default to configuration parameters */
   silc_server_config_set_defaults(config_new);
 
-  config_new->refcount = 1;
   return config_new;
 }
 
@@ -1270,7 +1270,7 @@ void silc_server_config_ref(SilcServerConfigRef *ref, SilcServerConfig config,
     config->refcount++;
     ref->config = config;
     ref->ref_ptr = ref_ptr;
-    SILC_LOG_DEBUG(("Referencing config [%p] refcnt %hu->%hu", config,
+    SILC_LOG_DEBUG(("Referencing config [%p] refcnt %d->%d", config,
                    config->refcount - 1, config->refcount));
   }
 }
@@ -1291,7 +1291,7 @@ void silc_server_config_destroy(SilcServerConfig config)
   void *tmp;
 
   config->refcount--;
-  SILC_LOG_DEBUG(("Unreferencing config [%p] refcnt %hu->%hu", config,
+  SILC_LOG_DEBUG(("Unreferencing config [%p] refcnt %d->%d", config,
                  config->refcount + 1, config->refcount));
   if (config->refcount > 0)
     return;