------------------------------------------------------------ revno: 14085 revision-id: squid3@treenet.co.nz-20160923111148-pjwuzgfvac43phk4 parent: squid3@treenet.co.nz-20160921020936-2tn38o3ed7ssydfw author: Alex Rousskov committer: Amos Jeffries branch nick: 3.5 timestamp: Fri 2016-09-23 23:11:48 +1200 message: Do reset $HOME if needed after r13435. Minimize putenv() memory leaks. While r13435 is attributed to me, the wrong condition was not mine. This is a good example of why "cmp() op 0" pattern is usually safer because the "==" or "!=" operator "tells" us whether the strings are equal, unlike "!cmp()" that is often misread as "not equal". ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20160923111148-pjwuzgfvac43phk4 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # testament_sha1: 1ee13663f00dfee525ba77da72d97b65ff8fcf40 # timestamp: 2016-09-23 11:32:15 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # base_revision_id: squid3@treenet.co.nz-20160921020936-\ # 2tn38o3ed7ssydfw # # Begin patch === modified file 'src/cache_cf.cc' --- src/cache_cf.cc 2016-01-01 00:14:27 +0000 +++ src/cache_cf.cc 2016-09-23 11:11:48 +0000 @@ -849,7 +849,7 @@ if (pwd->pw_dir && *pwd->pw_dir) { // putenv() leaks by design; avoid leaks when nothing changes static SBuf lastDir; - if (lastDir.isEmpty() || !lastDir.cmp(pwd->pw_dir)) { + if (lastDir.isEmpty() || lastDir.cmp(pwd->pw_dir) != 0) { lastDir = pwd->pw_dir; int len = strlen(pwd->pw_dir) + 6; char *env_str = (char *)xcalloc(len, 1);