diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2016-02-19 15:50:12 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2016-03-09 15:14:01 +0100 |
commit | 2d84b65383f2d13d6f94ac561ad92907b59062f3 (patch) | |
tree | e3935cdc96903cccbee5aaf4e1c63fdb6e4e9e72 /src/ldb_modules | |
parent | 9df3b9dd412bc4392f13a601decc45380b6ba69b (diff) | |
download | sssd-2d84b65383f2d13d6f94ac561ad92907b59062f3.tar.gz sssd-2d84b65383f2d13d6f94ac561ad92907b59062f3.tar.xz sssd-2d84b65383f2d13d6f94ac561ad92907b59062f3.zip |
memberof: Don't allocate on a NULL context
https://fedorahosted.org/sssd/ticket/2959
In case no previous delete operation occured, the del_ctx->muops pointer we
allocate the diff structure was would be NULL, effectivelly leaking the
diff array during the memberof processing.
Allocating on del_ctx is safer as that pointer is always allocated and
prevents the leak.
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/ldb_modules')
-rw-r--r-- | src/ldb_modules/memberof.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ldb_modules/memberof.c b/src/ldb_modules/memberof.c index 83d93196c..54e4b3ee2 100644 --- a/src/ldb_modules/memberof.c +++ b/src/ldb_modules/memberof.c @@ -2145,7 +2145,7 @@ static int mbof_del_mod_entry(struct mbof_del_operation *delop) if (!el || !el->num_values) { return LDB_ERR_OPERATIONS_ERROR; } - diff = talloc_array(del_ctx->muops, struct ldb_dn *, + diff = talloc_array(del_ctx, struct ldb_dn *, el->num_values + 1); if (!diff) { return LDB_ERR_OPERATIONS_ERROR; @@ -2241,6 +2241,7 @@ static int mbof_del_mod_entry(struct mbof_del_operation *delop) if (ret != LDB_SUCCESS) { return ret; } + talloc_steal(del_ctx->muops, diff[i]); } } |