Code

object: Static wrapper objects cannot have a destructor.
authorSebastian Harl <sh@tokkee.org>
Wed, 9 Jul 2014 19:33:27 +0000 (21:33 +0200)
committerSebastian Harl <sh@tokkee.org>
Wed, 9 Jul 2014 19:33:27 +0000 (21:33 +0200)
We cannot free the static memory and, thus, cannot destroy the object.

src/backend/collectd/unixsock.c
src/include/core/object.h

index 7145e9d2dc45c387fade499c992428286ce2efac..b8bbbfe63c29fb638f5ceb5ede65f73b83126751 100644 (file)
@@ -261,8 +261,7 @@ sdb_collectd_collect(sdb_object_t *user_data)
        long int count;
 
        sdb_collectd_state_t state = SDB_COLLECTD_STATE_INIT;
-       sdb_object_wrapper_t state_obj = SDB_OBJECT_WRAPPER_STATIC(&state,
-                       /* destructor = */ NULL);
+       sdb_object_wrapper_t state_obj = SDB_OBJECT_WRAPPER_STATIC(&state);
 
        if (! user_data)
                return -1;
index 42352b085876b48cbbaca7716670d05c4bc06d14..a92fb53945676f65fbbada4bfe4f680d22427093 100644 (file)
@@ -133,8 +133,8 @@ sdb_object_t *
 sdb_object_create_wrapper(const char *name,
                void *data, void (*destructor)(void *));
 
-#define SDB_OBJECT_WRAPPER_STATIC(obj, destructor) \
-       { SDB_OBJECT_INIT, (obj), (destructor) }
+#define SDB_OBJECT_WRAPPER_STATIC(obj) \
+       { SDB_OBJECT_INIT, (obj), /* destructor */ NULL }
 
 /*
  * sdb_object_deref: