Print this page
2831 svc.startd and svc.configd waste memory.

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/librestart/common/librestart.c
          +++ new/usr/src/lib/librestart/common/librestart.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) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
       24 + * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  24   25   */
  25   26  
  26   27  #include <libintl.h>
  27   28  #include <librestart.h>
  28   29  #include <librestart_priv.h>
  29   30  #include <libscf.h>
  30   31  #include <libscf_priv.h>
  31   32  
  32   33  #include <assert.h>
  33   34  #include <ctype.h>
↓ open down ↓ 3292 lines elided ↑ open up ↑
3326 3327                          }
3327 3328                  }
3328 3329          }
3329 3330  
3330 3331          /*
3331 3332           * A method_context was not used for any configurable
3332 3333           * elements or attributes, so reset and use the simple
3333 3334           * defaults that provide historic init behavior.
3334 3335           */
3335 3336          if (mc_used == 0) {
     3337 +                free(cip->pwbuf);
     3338 +                free(cip->vbuf);
     3339 +                free(cip->working_dir);
     3340 +
3336 3341                  (void) memset(cip, 0, sizeof (*cip));
3337 3342                  cip->uid = 0;
3338 3343                  cip->gid = 0;
3339 3344                  cip->euid = (uid_t)-1;
3340 3345                  cip->egid = (gid_t)-1;
3341 3346          }
3342 3347  
3343 3348          *mcpp = cip;
3344 3349  
3345 3350  out:
3346 3351          (void) scf_value_destroy(val);
3347 3352          scf_property_destroy(prop);
3348 3353          scf_pg_destroy(instpg);
3349 3354          scf_pg_destroy(methpg);
3350 3355  
3351      -        if (cip->pwbuf != NULL)
     3356 +        if (cip->pwbuf != NULL) {
3352 3357                  free(cip->pwbuf);
     3358 +                cip->pwbuf = NULL;
     3359 +        }
     3360 +
3353 3361          free(cip->vbuf);
3354 3362  
3355 3363          if (err->type != 0) {
3356 3364                  restarter_free_method_context(cip);
3357 3365          } else {
3358 3366                  restarter_mc_error_destroy(err);
3359 3367                  err = NULL;
3360 3368          }
3361 3369  
3362 3370          return (err);
↓ open down ↓ 605 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX