From 8cb8a8932e6dea853fe608742c2f6429c112208d Mon Sep 17 00:00:00 2001 From: Landon Fuller Date: Wed, 17 Apr 2013 13:16:13 -0400 Subject: [PATCH] Remove unnecessary strdup() (and resulting leak) Signed-off-by: Love Hornquist Astrand --- lib/hdb/hdb-ldap.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/hdb/hdb-ldap.c b/lib/hdb/hdb-ldap.c index 81f822069..34956c8ed 100644 --- a/lib/hdb/hdb-ldap.c +++ b/lib/hdb/hdb-ldap.c @@ -1807,7 +1807,6 @@ hdb_ldap_common(krb5_context context, { struct hdbldapdb *h; const char *create_base = NULL; - char *ldap_url = NULL; if (url == NULL || url[0] == '\0') { const char *p; @@ -1816,9 +1815,7 @@ hdb_ldap_common(krb5_context context, if (p == NULL) p = default_ldap_url; - ldap_url = strdup(p); - } else { - ldap_url = strdup(url); + url = p; } if (search_base == NULL && search_base[0] == '\0') { @@ -1868,7 +1865,7 @@ hdb_ldap_common(krb5_context context, return ENOMEM; } - h->h_url = strdup(ldap_url); + h->h_url = strdup(url); h->h_base = strdup(search_base); if (h->h_url == NULL || h->h_base == NULL) { LDAP_destroy(context, *db);