aboutsummaryrefslogtreecommitdiffstats
path: root/Source/charon/logger.c
diff options
context:
space:
mode:
authorJan Hutter <jhutter@hsr.ch>2005-11-11 11:20:22 +0000
committerJan Hutter <jhutter@hsr.ch>2005-11-11 11:20:22 +0000
commit96d72d323d6ab3d3f505a1fd8c5175ebe4ce7363 (patch)
treeb2814a3eb504c9472bdbd1144ddd28e72f152df5 /Source/charon/logger.c
parentffd555f58e8f75622162efb2e9c6e5482d829f06 (diff)
downloadstrongswan-96d72d323d6ab3d3f505a1fd8c5175ebe4ce7363.tar.bz2
strongswan-96d72d323d6ab3d3f505a1fd8c5175ebe4ce7363.tar.xz
- fixed bug in logger_t not storing the name of it
Diffstat (limited to 'Source/charon/logger.c')
-rw-r--r--Source/charon/logger.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/charon/logger.c b/Source/charon/logger.c
index 98f69ab1f..eee03b7fc 100644
--- a/Source/charon/logger.c
+++ b/Source/charon/logger.c
@@ -232,6 +232,7 @@ static status_t disable_level(private_logger_t *this, logger_level_t log_level)
*/
static status_t destroy(private_logger_t *this)
{
+ allocator_free(this->name);
allocator_free(this);
return SUCCESS;
}
@@ -248,6 +249,11 @@ logger_t *logger_create(char *logger_name, logger_level_t log_level,FILE * outpu
return NULL;
}
+ if (logger_name == NULL)
+ {
+ logger_name = "";
+ }
+
this->public.log = (status_t(*)(logger_t*,logger_level_t,char*,...))logg;
this->public.log_bytes = (status_t(*)(logger_t*, logger_level_t, char*,char*,size_t))log_bytes;
this->public.log_chunk = log_chunk;
@@ -259,7 +265,13 @@ logger_t *logger_create(char *logger_name, logger_level_t log_level,FILE * outpu
/* private variables */
this->level = log_level;
- this->name = logger_name;
+ this->name = allocator_alloc(strlen(logger_name) + 1);
+ if (this->name == NULL)
+ {
+ allocator_free(this);
+ return NULL;
+ }
+ strcpy(this->name,logger_name);
this->output = output;