]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/getattr.c
Fix typo in previous commit.
[openldap] / libraries / libldap / getattr.c
index f893529e8c05dd631b54cfee0422c16624c976e0..8e655da12efea0cb1aeb4a518ccc0f9f5b7780c2 100644 (file)
@@ -1,32 +1,24 @@
 /*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+/*  Portions
  *  Copyright (c) 1990 Regents of the University of Michigan.
  *  All rights reserved.
  *
  *  getattr.c
  */
 
-#ifndef lint 
-static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
-#endif
+#include "portable.h"
 
 #include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
 #include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
 
-#include "lber.h"
-#include "ldap.h"
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
 #include "ldap-int.h"
 
 char *
@@ -37,6 +29,7 @@ ldap_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **ber )
        Debug( LDAP_DEBUG_TRACE, "ldap_first_attribute\n", 0, 0, 0 );
 
        if ( (*ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
+               *ber = NULL;
                return( NULL );
        }
 
@@ -53,6 +46,7 @@ ldap_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **ber )
            == LBER_ERROR ) {
                ld->ld_errno = LDAP_DECODING_ERROR;
                ber_free( *ber, 0 );
+               *ber = NULL;
                return( NULL );
        }
 
@@ -72,7 +66,7 @@ ldap_next_attribute( LDAP *ld, LDAPMessage *entry, BerElement *ber )
        if ( ber_scanf( ber, "{sx}", ld->ld_attrbuffer, &len ) 
            == LBER_ERROR ) {
                ld->ld_errno = LDAP_DECODING_ERROR;
-               ber_free( ber, 0 );
+               /* ber_free( ber, 0 ); *//* don't free the BerElement */
                return( NULL );
        }