Fix memory leak in libnet_vampire_cb_store_chunk
Andrej Gessel
andrej.gessel at janztec.com
Wed Mar 7 09:52:20 UTC 2018
Hello,
now with sign-off-by.
I have already sent my DCO.
Andrej
Am 07.03.2018 um 01:21 schrieb Andrew Bartlett:
> On Tue, 2018-03-06 at 14:02 +0100, Andrej Gessel via samba-technical
> wrote:
>> Hello list,
>>
>> i found some older patch for possible memory leak in
>> libnet_vampire_cb_store_chunk.
>>
>> Please review. Thanks
> Thanks. The memory would stay on 's' until that is freed, but you are
> correct it could be freed earlier if the correct context was used.
>
> Can you add your signed-off-by and send in your DCO per the
> Contributing page in the wiki?
>
> Thanks!
>
-------------- next part --------------
From 6efe9a71e147ec5caa02bae35ee8c675ea8ea107 Mon Sep 17 00:00:00 2001
From: Andrej Gessel <Andrej.Gessel at janztec.com>
Date: Wed, 12 Apr 2017 15:12:49 +0200
Subject: [PATCH] bugfix memory leak. partition_dn is only used to search and
compare and is not freed at the function end.
Signed-off-by: Andrej Gessel <Andrej.Gessel at janztec.com>
---
source4/libnet/libnet_vampire.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c
index 2871a68..c4ef608 100644
--- a/source4/libnet/libnet_vampire.c
+++ b/source4/libnet/libnet_vampire.c
@@ -694,7 +694,7 @@ WERROR libnet_vampire_cb_store_chunk(void *private_data,
}
s->total_objects += object_count;
- partition_dn = ldb_dn_new(s, s->ldb, c->partition->nc.dn);
+ partition_dn = ldb_dn_new(s_dsa, s->ldb, c->partition->nc.dn);
if (partition_dn == NULL) {
DEBUG(0,("Failed to parse partition DN from DRS.\n"));
return WERR_INVALID_PARAMETER;
@@ -710,7 +710,7 @@ WERROR libnet_vampire_cb_store_chunk(void *private_data,
DEBUG(0,("Exop on[%s] objects[%u] linked_values[%u]\n",
c->partition->nc.dn, s->total_objects, linked_attributes_count));
}
- ret = dsdb_find_nc_root(s->ldb, s,
+ ret = dsdb_find_nc_root(s->ldb, s_dsa,
partition_dn, &nc_root);
if (ret != LDB_SUCCESS) {
DEBUG(0,(__location__ ": Failed to find nc_root for %s\n",
--
2.7.4
More information about the samba-technical
mailing list