source:
npl/system/nss_ldap/patches/fix_ldap_sessions_mem_leak.patch
Last change on this file was c5c522c, checked in by , 9 years ago | |
---|---|
|
|
File size: 2.3 KB |
-
ldap-nss.c
Description: Fix memory leak in libnss-ldap A memory leak in libnss-ldap over time can cause the nscd process to grow extremely large. . The ldap-nss.c do_init() may be called more then once, to initialize an ldap session and save the session in __session.ls_conn and set the __session.ls_stat = LD_INITIALIZED. But it does not check the state to see if has be initialized, and at line 1239: __session.ls_conn = NULL; Bug: http://bugzilla.padl.com/show_bug.cgi?id=418 Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/libnss-ldap/+bug/292971 Author: Doug Engert <deengert@anl.gov> Reviewed-by: Mathias Gug <mathiaz@ubuntu.com> Reviewed-by: Kees Cook <kees@ubuntu.com>
a b static void do_atfork_child (void); 184 184 static void do_atfork_setup (void); 185 185 #endif 186 186 187 static void do_atexit (void); /* allow exit to cleanup to help valgrind */ 187 188 /* 188 189 * Close the global session, sending an unbind. 189 190 */ … … do_atfork_setup (void) 551 552 (void) __libc_atfork (do_atfork_prepare, do_atfork_parent, do_atfork_child); 552 553 #endif 553 554 555 atexit(do_atexit); /* allow exit to cleanup to help valgrind */ 556 554 557 debug ("<== do_atfork_setup"); 555 558 } 556 559 #endif 557 560 558 561 /* 562 * allow exit to cleanup to help valgrind 563 */ 564 void 565 do_atexit (void) 566 { 567 debug ("<== do_atexit"); 568 _nss_ldap_enter(); 569 do_close(); 570 debug ("==> do_atexit (should be no more activity)"); 571 } 572 573 /* 559 574 * Acquires global lock, blocks SIGPIPE. 560 575 */ 561 576 void … … do_init (void) 1234 1249 } 1235 1250 } 1236 1251 1237 __session.ls_conn = NULL; 1252 /* LOOKS LIKE A PROBLEM. COULD BE INITIALIZED, BUT NOT CONNECTED */ 1253 if (__session.ls_state == LS_UNINITIALIZED) { 1238 1254 __session.ls_timestamp = 0; 1239 __session.ls_state = LS_UNINITIALIZED;1240 1255 1241 1256 #if defined(HAVE_PTHREAD_ONCE) && defined(HAVE_PTHREAD_ATFORK) 1242 1257 if (pthread_once (&__once, do_atfork_setup) != 0) … … do_init (void) 1355 1370 __session.ls_state = LS_INITIALIZED; 1356 1371 1357 1372 debug ("<== do_init (initialized session)"); 1373 } /* if already initialized but not connected */ 1374 else { 1375 debug ("<== do_init (already initialized)"); 1376 } 1358 1377 1359 1378 return NSS_SUCCESS; 1360 1379 } … … do_open (void) 1575 1594 } 1576 1595 else 1577 1596 { 1597 syslog(LOG_ERR, "nss-ldap: do_open: do_start_tls failed:stat=%d", stat); 1578 1598 do_close (); 1579 1599 debug ("<== do_open (TLS startup failed)"); 1580 1600 return stat;
Note: See TracBrowser
for help on using the repository browser.