summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-11-03 18:24:37 +0100
committerStephen Gallagher <sgallagh@redhat.com>2009-11-04 10:51:08 -0500
commit0efb1696699304475847ba8c190b42000b639463 (patch)
tree1220639832d95e5ff8073cbb3ea9de0696165c76 /server
parent2f8ec2a1f97ea04010c1582ffd42c0e0ee06fcc9 (diff)
downloadsssd-0efb1696699304475847ba8c190b42000b639463.tar.gz
sssd-0efb1696699304475847ba8c190b42000b639463.tar.bz2
sssd-0efb1696699304475847ba8c190b42000b639463.zip
Free the PCRE regexp with destructor
Diffstat (limited to 'server')
-rw-r--r--server/util/usertools.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/server/util/usertools.c b/server/util/usertools.c
index a3f7ad94..738ac62d 100644
--- a/server/util/usertools.c
+++ b/server/util/usertools.c
@@ -45,6 +45,15 @@ char *get_username_from_uid(TALLOC_CTX *mem_ctx, uid_t uid)
return username;
}
+static int sss_names_ctx_destructor(struct sss_names_ctx *snctx)
+{
+ if (snctx->re) {
+ pcre_free(snctx->re);
+ snctx->re = NULL;
+ }
+ return 0;
+}
+
int sss_names_init(TALLOC_CTX *mem_ctx, struct confdb_ctx *cdb, struct sss_names_ctx **out)
{
struct sss_names_ctx *ctx;
@@ -55,6 +64,7 @@ int sss_names_init(TALLOC_CTX *mem_ctx, struct confdb_ctx *cdb, struct sss_names
ctx = talloc_zero(mem_ctx, struct sss_names_ctx);
if (!ctx) return ENOMEM;
+ talloc_set_destructor(ctx, sss_names_ctx_destructor);
ret = confdb_get_string(cdb, ctx, CONFDB_MONITOR_CONF_ENTRY,
CONFDB_MONITOR_NAME_REGEX, NULL, &ctx->re_pattern);