diff options
| author | Gergely Nagy <algernon@balabit.hu> | 2012-04-16 00:36:37 +0200 |
|---|---|---|
| committer | Gergely Nagy <algernon@balabit.hu> | 2012-04-16 00:36:37 +0200 |
| commit | c568a2c036ee555faa7b24cdfe07d65af0a15361 (patch) | |
| tree | 57cfeb7816add8c9fc6e99dc89aa6452cb80f37c /lib | |
| parent | 142f411b1305d4c9857532f66e61a895604160a9 (diff) | |
| download | libumberlog-c568a2c036ee555faa7b24cdfe07d65af0a15361.tar.gz libumberlog-c568a2c036ee555faa7b24cdfe07d65af0a15361.tar.xz libumberlog-c568a2c036ee555faa7b24cdfe07d65af0a15361.zip | |
Free up the JSON buffer on exit
This adds a destructor that simply frees up the JSON buffer, so that
to not upset valgrind and similar tools too much.
Signed-off-by: Gergely Nagy <algernon@balabit.hu>
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/umberlog.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/umberlog.c b/lib/umberlog.c index fe0a6b7..84bd64b 100644 --- a/lib/umberlog.c +++ b/lib/umberlog.c @@ -51,6 +51,7 @@ static void (*old_openlog) (); static int (*old_setlogmask) (); static void ul_init (void) __attribute__((constructor)); +static void ul_finish (void) __attribute__((destructor)); static __thread struct { @@ -77,6 +78,12 @@ ul_init (void) old_setlogmask = dlsym (RTLD_NEXT, "setlogmask"); } +static void +ul_finish (void) +{ + free (ul_buffer.msg); +} + void ul_openlog (const char *ident, int option, int facility) { |
