Hello,

    Fix error handling in ldap_get_zone_serial().

    Successful call of zr_get_zone_ptr() attaches zone. Zone has to be
    detached regardless of dns_zone_getserial2() return code.

Petr^2 Spacek
From 5c88eed63ec896bfb4fddb3677dc63b0855c0f6a Mon Sep 17 00:00:00 2001
From: Petr Spacek <pspa...@redhat.com>
Date: Fri, 21 Sep 2012 15:16:45 +0200
Subject: [PATCH] Fix error handling in ldap_get_zone_serial().

Successful call of zr_get_zone_ptr() attaches zone. Zone has to be
detached regardless of dns_zone_getserial2() return code.

Signed-off-by: Petr Spacek <pspa...@redhat.com>
---
 src/ldap_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ldap_helper.c b/src/ldap_helper.c
index 2245cb982f26eab165a327b4ad72046f9eb4024e..ec20f9bc36953c2f73ef9ff3d5973fe866cb9b62 100644
--- a/src/ldap_helper.c
+++ b/src/ldap_helper.c
@@ -2964,9 +2964,10 @@ ldap_get_zone_serial(ldap_instance_t *inst, dns_name_t *zone_name,
 
 	CHECK(zr_get_zone_ptr(inst->zone_register, zone_name, &zone));
 	CHECK(dns_zone_getserial2(zone, serial));
-	dns_zone_detach(&zone);
 
 cleanup:
+	if (zone != NULL)
+		dns_zone_detach(&zone);
 	return result;
 }
 
-- 
1.7.11.4

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to