Print this page
3285 memory leaks in libsldap

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libsldap/common/ns_connect.c
          +++ new/usr/src/lib/libsldap/common/ns_connect.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
  24   25   */
  25   26  
  26   27  #include <stdlib.h>
  27   28  #include <stdio.h>
  28   29  #include <errno.h>
  29   30  #include <string.h>
  30   31  #include <synch.h>
  31   32  #include <time.h>
  32   33  #include <libintl.h>
  33   34  #include <thread.h>
↓ open down ↓ 434 lines elided ↑ open up ↑
 468  469  static void
 469  470  printCred(FILE *fp, const ns_cred_t *cred)
 470  471  {
 471  472          thread_t        t = thr_self();
 472  473  
 473  474          if (cred == NULL) {
 474  475                  (void) fprintf(fp, "tid= %d: printCred: cred is NULL\n", t);
 475  476                  return;
 476  477          }
 477  478  
 478      -        (void) fprintf(fp, "tid= %d: AuthType=%d", t, cred->auth.type);
 479      -        (void) fprintf(fp, "tid= %d: TlsType=%d", t, cred->auth.tlstype);
 480      -        (void) fprintf(fp, "tid= %d: SaslMech=%d", t, cred->auth.saslmech);
 481      -        (void) fprintf(fp, "tid= %d: SaslOpt=%d", t, cred->auth.saslopt);
      479 +        (void) fprintf(fp, "tid= %d: AuthType=%d\n", t, cred->auth.type);
      480 +        (void) fprintf(fp, "tid= %d: TlsType=%d\n", t, cred->auth.tlstype);
      481 +        (void) fprintf(fp, "tid= %d: SaslMech=%d\n", t, cred->auth.saslmech);
      482 +        (void) fprintf(fp, "tid= %d: SaslOpt=%d\n", t, cred->auth.saslopt);
 482  483          if (cred->hostcertpath)
 483  484                  (void) fprintf(fp, "tid= %d: hostCertPath=%s\n",
 484  485                      t, cred->hostcertpath);
 485  486          if (cred->cred.unix_cred.userID)
 486  487                  (void) fprintf(fp, "tid= %d: userID=%s\n",
 487  488                      t, cred->cred.unix_cred.userID);
 488  489          if (cred->cred.unix_cred.passwd)
 489  490                  (void) fprintf(fp, "tid= %d: passwd=%s\n",
 490  491                      t, cred->cred.unix_cred.passwd);
 491  492  }
↓ open down ↓ 202 lines elided ↑ open up ↑
 694  695          char *hReq, *host = NULL;
 695  696          LDAP *ld = NULL;
 696  697          int passwd_mgmt = 0;
 697  698          int totalbad = 0; /* Number of servers contacted unsuccessfully */
 698  699          short   memerr = 0; /* Variable for tracking memory allocation */
 699  700          char *serverAddrType = NULL, **bindHost = NULL;
 700  701  
 701  702  
 702  703          if (conp == NULL || errorp == NULL || auth == NULL)
 703  704                  return (NS_LDAP_INVALID_PARAM);
 704      -        *errorp = NULL;
      705 +        if (*errorp)
      706 +                __ns_ldap_freeError(errorp);
 705  707          *conp = NULL;
 706  708          (void) memset(&sinfo, 0, sizeof (sinfo));
 707  709  
 708  710          if ((id = findConnection(flags, serverAddr, auth, &con)) != -1) {
 709  711                  /* connection found in cache */
 710  712  #ifdef DEBUG
 711  713                  (void) fprintf(stderr, "tid= %d: connection found in "
 712  714                      "cache %d\n", thr_self(), id);
 713  715                  fflush(stderr);
 714  716  #endif /* DEBUG */
↓ open down ↓ 1982 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX