summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/libads/ldap_printer.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/source3/libads/ldap_printer.c b/source3/libads/ldap_printer.c
index e4bfbcead7..251dfb0a81 100644
--- a/source3/libads/ldap_printer.c
+++ b/source3/libads/ldap_printer.c
@@ -47,33 +47,25 @@
return status;
}
if (ads_count_replies(ads, *res) != 1) {
- if (res) {
- ads_msgfree(ads, *res);
- *res = NULL;
- }
+ ads_msgfree(ads, *res);
+ *res = NULL;
return ADS_ERROR(LDAP_NO_SUCH_OBJECT);
}
srv_dn = ldap_get_dn(ads->ldap.ld, *res);
if (srv_dn == NULL) {
- if (res) {
- ads_msgfree(ads, *res);
- *res = NULL;
- }
+ ads_msgfree(ads, *res);
+ *res = NULL;
return ADS_ERROR(LDAP_NO_MEMORY);
}
srv_cn = ldap_explode_dn(srv_dn, 1);
if (srv_cn == NULL) {
ldap_memfree(srv_dn);
- if (res) {
- ads_msgfree(ads, *res);
- *res = NULL;
- }
- return ADS_ERROR(LDAP_INVALID_DN_SYNTAX);
- }
- if (res) {
ads_msgfree(ads, *res);
*res = NULL;
+ return ADS_ERROR(LDAP_INVALID_DN_SYNTAX);
}
+ ads_msgfree(ads, *res);
+ *res = NULL;
if (asprintf(&s, "(cn=%s-%s)", srv_cn[0], printer) == -1) {
ldap_memfree(srv_dn);