From 042898d2f0bc21a3f8c755ddc0f49487b4a12dee Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Thu, 20 May 1999 19:38:03 +0000
Subject: [PATCH] Version.c deprecated in favor of mkversion. Minor cleanup to
 lber files.

---
 libraries/libavl/Version.c    | 13 ----------
 libraries/liblber/Version.c   | 17 -------------
 libraries/liblber/decode.c    | 10 +++-----
 libraries/libldap/Version.c   | 17 -------------
 libraries/libldap/unbind.c    | 46 +++++++++++++++++++++++++++--------
 libraries/libldap_r/Version.c |  5 ----
 libraries/libldbm/Version.c   | 13 ----------
 libraries/libldif/Version.c   | 13 ----------
 8 files changed, 40 insertions(+), 94 deletions(-)
 delete mode 100644 libraries/libavl/Version.c
 delete mode 100644 libraries/liblber/Version.c
 delete mode 100644 libraries/libldap/Version.c
 delete mode 100644 libraries/libldap_r/Version.c
 delete mode 100644 libraries/libldbm/Version.c
 delete mode 100644 libraries/libldif/Version.c

diff --git a/libraries/libavl/Version.c b/libraries/libavl/Version.c
deleted file mode 100644
index 182138d053..0000000000
--- a/libraries/libavl/Version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1995 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-static char Version[] = "  libavl.a v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/libraries/liblber/Version.c b/libraries/liblber/Version.c
deleted file mode 100644
index 61093cd832..0000000000
--- a/libraries/liblber/Version.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
- */
-/* Portions
- * Copyright (c) 1991 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-static char Version[] = "  liblber.a v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/libraries/liblber/decode.c b/libraries/liblber/decode.c
index 3fe5030ada..bddb359d08 100644
--- a/libraries/liblber/decode.c
+++ b/libraries/liblber/decode.c
@@ -446,11 +446,9 @@ va_dcl
 
 	fmt_reset = fmt;
 
-	if ( ber->ber_debug ) {
-		ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
-			"ber_scanf fmt (%s) ber:\n", fmt );
-		ber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 );
-	}
+	ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
+		"ber_scanf fmt (%s) ber:\n", fmt );
+	ber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 );
 
 	for ( rc = 0; *fmt && rc != LBER_DEFAULT; fmt++ ) {
 		/* When this is modified, remember to update
@@ -670,7 +668,7 @@ va_dcl
 
 		case 'o':	/* octet string in a supplied berval */
 			bval = va_arg( ap, struct berval * );
-			if ( bval->bv_val ) {
+			if ( bval->bv_val != NULL ) {
 				free( bval->bv_val );
 				bval->bv_val = NULL;
 			}
diff --git a/libraries/libldap/Version.c b/libraries/libldap/Version.c
deleted file mode 100644
index 9a043d706b..0000000000
--- a/libraries/libldap/Version.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
- */
-/* Portions
- * Copyright (c) 1991 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-static char Version[] = "  libldap.a v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/libraries/libldap/unbind.c b/libraries/libldap/unbind.c
index fb1c2e4d4d..c9f14ec34a 100644
--- a/libraries/libldap/unbind.c
+++ b/libraries/libldap/unbind.c
@@ -84,34 +84,60 @@ ldap_ld_free(
 	}
 
 #ifndef LDAP_NOCACHE
-	if ( ld->ld_cache != NULL )
+	if ( ld->ld_cache != NULL ) {
 		ldap_destroy_cache( ld );
+		ld->ld_cache = NULL;
+	}
 #endif /* !LDAP_NOCACHE */
-	if ( ld->ld_error != NULL )
+
+	if ( ld->ld_error != NULL ) {
 		free( ld->ld_error );
-	if ( ld->ld_matched != NULL )
+		ld->ld_error = NULL;
+	}
+
+	if ( ld->ld_matched != NULL ) {
 		free( ld->ld_matched );
-	if ( ld->ld_host != NULL )
+		ld->ld_matched = NULL;
+	}
+
+	if ( ld->ld_host != NULL ) {
 		free( ld->ld_host );
-	if ( ld->ld_ufnprefix != NULL )
+		ld->ld_host = NULL;
+	}
+
+	if ( ld->ld_ufnprefix != NULL ) {
 		free( ld->ld_ufnprefix );
-	if ( ld->ld_filtd != NULL )
+		ld->ld_ufnprefix = NULL;
+	}
+
+	if ( ld->ld_filtd != NULL ) {
 		ldap_getfilter_free( ld->ld_filtd );
-	if ( ld->ld_abandoned != NULL )
+		ld->ld_filtd = NULL;
+	}
+
+	if ( ld->ld_abandoned != NULL ) {
 		free( ld->ld_abandoned );
+		ld->ld_abandoned = NULL;
+	}
 
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
-	if ( ld->ld_selectinfo != NULL )
+	if ( ld->ld_selectinfo != NULL ) {
 		ldap_free_select_info( ld->ld_selectinfo );
+		ld->ld_selectinfo = NULL;
+	}
 #else
 	ber_clear( &(ld->ld_ber), 1 );
 #endif /* LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS */
 
-	if ( ld->ld_options.ldo_defbase != NULL )
+	if ( ld->ld_options.ldo_defbase != NULL ) {
 		free( ld->ld_options.ldo_defbase );
+		ld->ld_options.ldo_defbase = NULL;
+	}
 
-	if ( ld->ld_options.ldo_defhost != NULL )
+	if ( ld->ld_options.ldo_defhost != NULL ) {
 		free( ld->ld_options.ldo_defhost );
+		ld->ld_options.ldo_defhost = NULL;
+	}
 
 	ber_pvt_sb_destroy( &(ld->ld_sb) );   
    
diff --git a/libraries/libldap_r/Version.c b/libraries/libldap_r/Version.c
deleted file mode 100644
index a827b3314c..0000000000
--- a/libraries/libldap_r/Version.c
+++ /dev/null
@@ -1,5 +0,0 @@
-/*
- * Reentrant version of -lldap
- */
-
-static char Version[] = "  libldap_r.a v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/libraries/libldbm/Version.c b/libraries/libldbm/Version.c
deleted file mode 100644
index c71ad08c91..0000000000
--- a/libraries/libldbm/Version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1995 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-static char Version[] = "  libldbm.a v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
diff --git a/libraries/libldif/Version.c b/libraries/libldif/Version.c
deleted file mode 100644
index d4d4fbf1fd..0000000000
--- a/libraries/libldif/Version.c
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * Copyright (c) 1996 Regents of the University of Michigan.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms are permitted
- * provided that this notice is preserved and that due credit is given
- * to the University of Michigan at Ann Arbor. The name of the University
- * may not be used to endorse or promote products derived from this
- * software without specific prior written permission. This software
- * is provided ``as is'' without express or implied warranty.
- */
-
-static char Version[] = "  libldif.a v%VERSION% (%WHEN%)\n\t%WHOANDWHERE%\n";
-- 
GitLab