diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/datastore.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/main/datastore.c b/main/datastore.c index 1170e24f8..a12bbdf34 100644 --- a/main/datastore.c +++ b/main/datastore.c @@ -31,12 +31,14 @@ #include "asterisk/utils.h" #include "asterisk/astobj2.h" #include "asterisk/uuid.h" +#include "asterisk/module.h" /*! \brief Number of buckets for datastore container */ #define DATASTORE_BUCKETS 53 -struct ast_datastore *__ast_datastore_alloc(const struct ast_datastore_info *info, const char *uid, - const char *file, int line, const char *function) +struct ast_datastore *__ast_datastore_alloc( + const struct ast_datastore_info *info, const char *uid, struct ast_module *mod, + const char *file, int line, const char *function) { struct ast_datastore *datastore = NULL; @@ -50,12 +52,15 @@ struct ast_datastore *__ast_datastore_alloc(const struct ast_datastore_info *inf } datastore->info = info; + datastore->mod = mod; if (!ast_strlen_zero(uid) && !(datastore->uid = ast_strdup(uid))) { ast_free(datastore); datastore = NULL; } + ast_module_ref(mod); + return datastore; } @@ -75,6 +80,8 @@ int ast_datastore_free(struct ast_datastore *datastore) datastore->uid = NULL; } + ast_module_unref(datastore->mod); + /* Finally free memory used by ourselves */ ast_free(datastore); |