Version bump, fixed memory leak.
authorChristian Zoffoli <xmerlin@gentoo.org>
Wed, 28 Feb 2007 17:29:28 +0000 (17:29 +0000)
committerChristian Zoffoli <xmerlin@gentoo.org>
Wed, 28 Feb 2007 17:29:28 +0000 (17:29 +0000)
Package-Manager: portage-2.1.2-r9

sys-cluster/heartbeat/ChangeLog
sys-cluster/heartbeat/Manifest
sys-cluster/heartbeat/files/digest-heartbeat-2.0.8 [new file with mode: 0644]
sys-cluster/heartbeat/files/heartbeat-2.0.8-crm-leaks.patch [new file with mode: 0644]
sys-cluster/heartbeat/heartbeat-2.0.7-r2.ebuild
sys-cluster/heartbeat/heartbeat-2.0.8.ebuild [new file with mode: 0644]

index 0ddc17c58e6e1dcc00fa47d3276aaa90360c1f91..a442f4762436c90f083aebd617899c9a8c1fe3f0 100644 (file)
@@ -1,6 +1,13 @@
 # ChangeLog for sys-cluster/heartbeat
-# Copyright 2000-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-cluster/heartbeat/ChangeLog,v 1.59 2006/09/25 23:57:35 xmerlin Exp $
+# Copyright 2000-2007 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/heartbeat/ChangeLog,v 1.60 2007/02/28 17:29:28 xmerlin Exp $
+
+*heartbeat-2.0.8 (28 Feb 2007)
+
+  28 Feb 2007; Christian Zoffoli <xmerlin@gentoo.org>
+  +files/heartbeat-2.0.8-crm-leaks.patch, heartbeat-2.0.7-r2.ebuild,
+  +heartbeat-2.0.8.ebuild:
+  Version bump, fixed memory leak.
 
   26 Sep 2006; Christian Zoffoli <xmerlin@gentoo.org>
   heartbeat-1.2.5-r1.ebuild, heartbeat-2.0.7-r2.ebuild:
index 8077c457c50a2d599f4f64ab015fbde3c8027f40..c68483273659f886caaf2fb2b18d6d2eeb2ed1d8 100644 (file)
@@ -1,16 +1,18 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
 AUX heartbeat-2.0.7-update-resources-failcount.patch 6648 RMD160 71e59accbad7883af4dae8d129ff15cdb59105fc SHA1 cc644a7d69c3d999bc440083723951cce1011b67 SHA256 0a08f4e45037724a3cc0877a16452d351535cee2d43dcb4a4bbd47c6c9ab7f3f
 MD5 d79f60a454bf23d2160a9deb419cf7b8 files/heartbeat-2.0.7-update-resources-failcount.patch 6648
 RMD160 71e59accbad7883af4dae8d129ff15cdb59105fc files/heartbeat-2.0.7-update-resources-failcount.patch 6648
 SHA256 0a08f4e45037724a3cc0877a16452d351535cee2d43dcb4a4bbd47c6c9ab7f3f files/heartbeat-2.0.7-update-resources-failcount.patch 6648
+AUX heartbeat-2.0.8-crm-leaks.patch 16011 RMD160 f5cd30e246a36329d2fb81d798c0c07b21a71645 SHA1 583882aa32fe4168392699dfefc03557a11af5da SHA256 559d192f47de95288d7a09c4d669801b623ab47b1ad39104ddde6d2d86b9bba0
+MD5 bc9813d5a2e18db81d538a2d9a719ea8 files/heartbeat-2.0.8-crm-leaks.patch 16011
+RMD160 f5cd30e246a36329d2fb81d798c0c07b21a71645 files/heartbeat-2.0.8-crm-leaks.patch 16011
+SHA256 559d192f47de95288d7a09c4d669801b623ab47b1ad39104ddde6d2d86b9bba0 files/heartbeat-2.0.8-crm-leaks.patch 16011
 AUX heartbeat-init 1616 RMD160 2a76f26e572b0b466fa860f8eab0fad5fcb6e29f SHA1 9c20eff23ee59434b1d9f222adb587c1bc7a7e26 SHA256 98e34d2e9d6fde5e8dedb1b4d934fa39b502f2d4e603e9faa7a86b66cd0e0437
 MD5 74949e88062a20f9c6c20dd01c20533b files/heartbeat-init 1616
 RMD160 2a76f26e572b0b466fa860f8eab0fad5fcb6e29f files/heartbeat-init 1616
 SHA256 98e34d2e9d6fde5e8dedb1b4d934fa39b502f2d4e603e9faa7a86b66cd0e0437 files/heartbeat-init 1616
 DIST heartbeat-1.2.5.tar.gz 2107371 RMD160 0e94fa64339b9b77e11ffe92cffa66fef4f4f2b0 SHA1 eeea454bcf0e12dd1135f6544c95584fa2e66770 SHA256 46f88a69324012317a4426dc93654ab28947b77675826686624d15cd5a4e357f
 DIST heartbeat-2.0.7.tar.gz 3327126 RMD160 8fe70e64fc6714fef4e501ae0b240d870a51cf75 SHA1 c0caf848b90d2fc76e0a390aaf59352d580d714a SHA256 008214f51fd0c49e168d1bb262cb5c967bc166f99d0c8ff3a2623c8ba51a0ab3
+DIST heartbeat-2.0.8.tar.gz 3502095 RMD160 76f3a56cbbafac8c35a87266b73d46a86de86feb SHA1 1805fc4c6218f05006c506d532728c6664d5a35c SHA256 b8425098e1243976f1e9deedfbf763fd42f0461bdd8933b0b8a94f0626912c91
 EBUILD heartbeat-1.2.5-r1.ebuild 2018 RMD160 1da95a075b2633723358c6b272ecc597b377b0c7 SHA1 d29b0d2e443881cc5984fa5229e7deac1250e715 SHA256 e8c7ad0c8447f65ffe56e84f3cd2f9e9330d8477a478a75f9cb272f2fc712f6e
 MD5 4c84b67e1ee8e79e60afa24f48959bc4 heartbeat-1.2.5-r1.ebuild 2018
 RMD160 1da95a075b2633723358c6b272ecc597b377b0c7 heartbeat-1.2.5-r1.ebuild 2018
@@ -23,14 +25,18 @@ EBUILD heartbeat-2.0.7-r1.ebuild 2974 RMD160 fd1d23ef5ffd94be642569fb8daaaa8b327
 MD5 ad8ef101825b35126e9f8db18c85d747 heartbeat-2.0.7-r1.ebuild 2974
 RMD160 fd1d23ef5ffd94be642569fb8daaaa8b327ab2c6 heartbeat-2.0.7-r1.ebuild 2974
 SHA256 b15613b71a255ca99355549332fefb53faac9ade794de2e4fb15d31ece6bcb13 heartbeat-2.0.7-r1.ebuild 2974
-EBUILD heartbeat-2.0.7-r2.ebuild 3079 RMD160 b0c5610e05c8fbf76f5c060c799f3fae964ba944 SHA1 2bedbeabe625db0559a5e3bc8b62b1ff95ca279d SHA256 fae0a39044dacf6ee71ef3147c7813ef7552bd8cc428ad1be5af073c37de2e5b
-MD5 4799de26c2c20a2ae6063476f1f518dc heartbeat-2.0.7-r2.ebuild 3079
-RMD160 b0c5610e05c8fbf76f5c060c799f3fae964ba944 heartbeat-2.0.7-r2.ebuild 3079
-SHA256 fae0a39044dacf6ee71ef3147c7813ef7552bd8cc428ad1be5af073c37de2e5b heartbeat-2.0.7-r2.ebuild 3079
-MISC ChangeLog 9979 RMD160 381ddec2d2b9432444e6e60c5432f0b5a4e136a7 SHA1 54f5ce10f51f856e748e1813920522372a9ec22e SHA256 1d5757bf0f2218431d8e82378666fa8d4479de2934709c894238bd7cb92fe4f0
-MD5 26d846c0d1316ea0e6db08db66cecf95 ChangeLog 9979
-RMD160 381ddec2d2b9432444e6e60c5432f0b5a4e136a7 ChangeLog 9979
-SHA256 1d5757bf0f2218431d8e82378666fa8d4479de2934709c894238bd7cb92fe4f0 ChangeLog 9979
+EBUILD heartbeat-2.0.7-r2.ebuild 3128 RMD160 a3dde1723ded736bbe654141e0a57a053eed9c55 SHA1 61a1656262f8a412015660d6c08a2534716ab0b8 SHA256 1086614c3b0f08b100521264328366be495226837b71c091f640bff28dc2e2a6
+MD5 5e7cc1f69f30bb0cf9b8b3f36c6f407e heartbeat-2.0.7-r2.ebuild 3128
+RMD160 a3dde1723ded736bbe654141e0a57a053eed9c55 heartbeat-2.0.7-r2.ebuild 3128
+SHA256 1086614c3b0f08b100521264328366be495226837b71c091f640bff28dc2e2a6 heartbeat-2.0.7-r2.ebuild 3128
+EBUILD heartbeat-2.0.8.ebuild 3126 RMD160 00786494cedfdf61997603335ac337eac335bcc2 SHA1 0767f5c27b7aef2ac444966f49d51f3d35d06cfd SHA256 8ec998f6b663ca229e8ffd47eead5a44a350a6adb30ad9fb298ef732630d31f9
+MD5 b270e315f83bacf3ac8339429b03b61c heartbeat-2.0.8.ebuild 3126
+RMD160 00786494cedfdf61997603335ac337eac335bcc2 heartbeat-2.0.8.ebuild 3126
+SHA256 8ec998f6b663ca229e8ffd47eead5a44a350a6adb30ad9fb298ef732630d31f9 heartbeat-2.0.8.ebuild 3126
+MISC ChangeLog 10197 RMD160 634e08cdb17c274db78806732042bdd7333e0292 SHA1 cacaf3318f73afb8cd699f36b92275cbc68d1aa2 SHA256 169df4f47a8c92a5a56f93af3bfa2007da09904fe85e8d92fdd1375d2f25f10c
+MD5 75aaf275368f80eb697c9d59292a292e ChangeLog 10197
+RMD160 634e08cdb17c274db78806732042bdd7333e0292 ChangeLog 10197
+SHA256 169df4f47a8c92a5a56f93af3bfa2007da09904fe85e8d92fdd1375d2f25f10c ChangeLog 10197
 MISC metadata.xml 339 RMD160 503ff4e79821bcf9851a8a6f8df0d43b3be8aa99 SHA1 7af6b38347db8330de0f27dbe2677156b524ebf9 SHA256 bb453c6b308cf1dfcbd818320ea43b654620a2b28dc24296c35367d803062635
 MD5 469a4f6cad0c54b4faed31a2852af816 metadata.xml 339
 RMD160 503ff4e79821bcf9851a8a6f8df0d43b3be8aa99 metadata.xml 339
@@ -47,10 +53,6 @@ SHA256 4e28f3c92fda41c864ef7aaa4d6b540a751f22135d21ae4be00a89cf5c57425d files/di
 MD5 730e170420e55cc6abbb746fb0f0ae14 files/digest-heartbeat-2.0.7-r2 250
 RMD160 c33c56e13bd882781b92ac96f8a8d4fff191208e files/digest-heartbeat-2.0.7-r2 250
 SHA256 4e28f3c92fda41c864ef7aaa4d6b540a751f22135d21ae4be00a89cf5c57425d files/digest-heartbeat-2.0.7-r2 250
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.4 (GNU/Linux)
-
-iD8DBQFFGHxigMUyd/cdjWsRAt5kAJ90rrS7JL7bd5/Dcu6RF00UWnI4EQCfZDg7
-PROVv3SHojyUkkbeMwYkIu8=
-=Zqp7
------END PGP SIGNATURE-----
+MD5 ef7387c518ef2edc760b03b315c8c317 files/digest-heartbeat-2.0.8 250
+RMD160 35bdcccc961fd6f59b322dd33ff77d634eb3b1f9 files/digest-heartbeat-2.0.8 250
+SHA256 0564a282436fc080d1109032099efc547911dfc0f572e61e64d78c9c163f493d files/digest-heartbeat-2.0.8 250
diff --git a/sys-cluster/heartbeat/files/digest-heartbeat-2.0.8 b/sys-cluster/heartbeat/files/digest-heartbeat-2.0.8
new file mode 100644 (file)
index 0000000..7399aaf
--- /dev/null
@@ -0,0 +1,3 @@
+MD5 39d7d12d2a7d5c98d1e3f8ae7977a3e6 heartbeat-2.0.8.tar.gz 3502095
+RMD160 76f3a56cbbafac8c35a87266b73d46a86de86feb heartbeat-2.0.8.tar.gz 3502095
+SHA256 b8425098e1243976f1e9deedfbf763fd42f0461bdd8933b0b8a94f0626912c91 heartbeat-2.0.8.tar.gz 3502095
diff --git a/sys-cluster/heartbeat/files/heartbeat-2.0.8-crm-leaks.patch b/sys-cluster/heartbeat/files/heartbeat-2.0.8-crm-leaks.patch
new file mode 100644 (file)
index 0000000..046b9bd
--- /dev/null
@@ -0,0 +1,601 @@
+diff -r 2d298bca0d0a crm/cib/io.c
+--- a/crm/cib/io.c     Thu Jan 11 18:42:41 2007 -0700
++++ b/crm/cib/io.c     Fri Feb 09 15:05:29 2007 +0100
+@@ -121,7 +121,8 @@ validate_cib_digest(crm_data_t *local_ci
+       crm_malloc0(expected, (length+1));
+       read_len = fread(expected, 1, length, expected_strm);
+       CRM_ASSERT(read_len == length);
+-
++      fclose(expected_strm);
++      
+       if(expected == NULL) {
+               crm_err("On-disk digest is empty");
+               
+@@ -635,6 +636,8 @@ write_cib_contents(gpointer p)
+                epoch?epoch:"0", updates?updates:"0", digest); 
+       
+       rc = write_cib_digest(the_cib, digest);
++      crm_free(digest);
++
+       if(rc <= 0) {
+               crm_err("Digest couldn't be written to disk");
+               exit(LSB_EXIT_GENERIC);
+@@ -650,7 +653,6 @@ write_cib_contents(gpointer p)
+               exit(LSB_EXIT_OK);
+       }
+       
+-      crm_free(digest);
+       return HA_OK;
+ }
+diff -r 2d298bca0d0a crm/crmd/callbacks.c
+--- a/crm/crmd/callbacks.c     Thu Jan 11 18:42:41 2007 -0700
++++ b/crm/crmd/callbacks.c     Fri Feb 09 15:05:29 2007 +0100
+@@ -410,28 +410,33 @@ crmd_client_status_callback(const char *
+       trigger_fsa(fsa_source);
+ }
+-static void
++void
+ crmd_ipc_connection_destroy(gpointer user_data)
+ {
++      GCHSource *source = NULL;
+       crmd_client_t *client = user_data;
+       if(client == NULL) {
+               crm_debug_4("No client to delete");
+               return;
+       }
+-      
+-      if(client->client_source != NULL) {
+-              crm_debug_4("Deleting %s (%p) from mainloop",
+-                          client->uuid, client->client_source);
+-              G_main_del_IPC_Channel(client->client_source); 
+-              client->client_source = NULL;
+-      }
+-
+-      crm_debug_3("Freeing %s client", client->uuid);
+-      crm_free(client->table_key);
+-      crm_free(client->sub_sys);
+-      crm_free(client->uuid);
+-      crm_free(client);
++
++      source = client->client_source;
++      client->client_source = NULL;
++      crm_debug_3("Processing %s (%p)", client->uuid, source);
++      if(source != NULL) {
++              crm_debug_2("Deleting %s (%p) from mainloop",
++                          client->uuid, source);
++              /* this will re-call crmd_ipc_connection_destroy() */
++              G_main_del_IPC_Channel(source);
++
++      } else {
++              crm_debug_2("Freeing %s client", client->uuid);
++              crm_free(client->table_key);
++              crm_free(client->sub_sys);
++              crm_free(client->uuid);
++              crm_free(client);
++      }
+       return;
+ }
+@@ -604,11 +609,7 @@ crmd_ccm_msg_callback(
+                       trigger_transition?A_TE_CANCEL:A_NOTHING,
+                       FALSE, __FUNCTION__);
+               
+-              if (event_data->oc) {
+-                      crm_free(event_data->oc);
+-                      event_data->oc = NULL;
+-              }
+-              crm_free(event_data);
++              delete_ccm_data(event_data);
+       } 
+       
+       oc_ev_callback_done(cookie);
+diff -r 2d298bca0d0a crm/crmd/ccm.c
+--- a/crm/crmd/ccm.c   Thu Jan 11 18:42:41 2007 -0700
++++ b/crm/crmd/ccm.c   Fri Feb 09 15:05:30 2007 +0100
+@@ -49,7 +49,6 @@ void crmd_ccm_msg_callback(oc_ed_t event
+                            size_t size,
+                            const void *data);
+-gboolean ghash_node_clfree(gpointer key, gpointer value, gpointer user_data);
+ void ghash_update_cib_node(gpointer key, gpointer value, gpointer user_data);
+ #define CCM_EVENT_DETAIL 0
+@@ -446,22 +445,9 @@ do_ccm_update_cache(long long action,
+                   g_hash_table_size(fsa_membership_copy->members),
+                   g_hash_table_size(fsa_membership_copy->new_members),
+                   g_hash_table_size(fsa_membership_copy->dead_members));
+-      
+-      /* Free the old copy */
+-      if(tmp != NULL) {
+-              if(tmp->members != NULL)
+-                      g_hash_table_foreach_remove(
+-                              tmp->members, ghash_node_clfree, NULL);
+-              if(tmp->new_members != NULL)
+-                      g_hash_table_foreach_remove(
+-                              tmp->new_members, ghash_node_clfree, NULL);
+-              if(tmp->dead_members != NULL)
+-                      g_hash_table_foreach_remove(
+-                              tmp->dead_members, ghash_node_clfree, NULL);
+-              crm_free(tmp);
+-      }
+-      crm_debug_3("Free'd old copies");
+-
++
++      free_ccm_cache(tmp);
++      
+       set_bit_inplace(fsa_input_register, R_CCM_DATA);
+       if(cur_state != S_STOPPING) {
+@@ -680,15 +666,4 @@ ghash_update_cib_node(gpointer key, gpoi
+       free_xml(tmp1);
+ }
+-gboolean
+-ghash_node_clfree(gpointer key, gpointer value, gpointer user_data)
+-{
+-      /* value->node_uname is free'd as "key" */
+-      if(key != NULL) {
+-              crm_free(key);
+-      }
+-      if(value != NULL) {
+-              crm_free(value);
+-      }
+-      return TRUE;
+-}
++
+diff -r 2d298bca0d0a crm/crmd/crmd_callbacks.h
+--- a/crm/crmd/crmd_callbacks.h        Thu Jan 11 18:42:41 2007 -0700
++++ b/crm/crmd/crmd_callbacks.h        Fri Feb 09 15:05:30 2007 +0100
+@@ -29,6 +29,8 @@ extern void crmd_ccm_msg_callback(
+  * Returning FALSE means "we're all done, close the connection"
+  */
++extern void crmd_ipc_connection_destroy(gpointer user_data);
++
+ extern gboolean crmd_ha_msg_dispatch(
+       ll_cluster_t *cluster_conn, gpointer user_data);
+diff -r 2d298bca0d0a crm/crmd/crmd_utils.h
+--- a/crm/crmd/crmd_utils.h    Thu Jan 11 18:42:41 2007 -0700
++++ b/crm/crmd/crmd_utils.h    Fri Feb 09 15:05:30 2007 +0100
+@@ -23,6 +23,9 @@
+ #include <crm/common/xml.h>
+ #define CLIENT_EXIT_WAIT 30
++
++extern void free_ccm_cache(oc_node_list_t *tmp);
++extern void delete_ccm_data(struct crmd_ccm_data_s *ccm_input);
+ extern void process_client_disconnect(crmd_client_t *curr_client);
+diff -r 2d298bca0d0a crm/crmd/lrm.c
+--- a/crm/crmd/lrm.c   Thu Jan 11 18:42:41 2007 -0700
++++ b/crm/crmd/lrm.c   Fri Feb 09 15:05:30 2007 +0100
+@@ -358,7 +358,6 @@ get_rsc_metadata(const char *type, const
+       metadata = g_hash_table_lookup(meta_hash, key);
+       if(metadata) {
+               crm_debug_2("Returning cached metadata for %s", key);
+-              crm_free(key);
+               goto out;
+       }
+@@ -368,14 +367,15 @@ get_rsc_metadata(const char *type, const
+       if(metadata) {
+               g_hash_table_insert(meta_hash, key, metadata);
+-      }
++              key = NULL; /* prevent it from being free'd */
++
++      } else {
++              crm_warn("No metadata found for %s", key);
++      }               
+   out:
+-      if(metadata == NULL) {
+-              crm_warn("No metadata found for %s::%s:%s",
+-                       class, type, provider);
+-      }
+-      
++      
++      crm_free(key);
+       return metadata;
+ }
+@@ -429,7 +429,9 @@ get_rsc_restart_list(lrm_rsc_t *rsc, lrm
+       return restart_list;
+ }
+-static void
++void append_restart_list(crm_data_t *update, lrm_op_t *op, const char *version);
++
++void
+ append_restart_list(crm_data_t *update, lrm_op_t *op, const char *version) 
+ {
+       int len = 0;
+@@ -686,8 +688,6 @@ build_operation_update(
+       if(args_parent == NULL) {
+               free_xml(args_xml);
+       }
+-
+-      append_restart_list(xml_op, op, caller_version);
+       
+       return TRUE;
+ }
+@@ -859,7 +859,8 @@ do_lrm_query(gboolean is_replace)
+       }
+       xml_result = create_cib_fragment(xml_state, XML_CIB_TAG_STATUS);
+-
++      free_xml(xml_state);
++      
+       crm_log_xml_debug_3(xml_state, "Current state of the LRM");
+       
+       return xml_result;
+diff -r 2d298bca0d0a crm/crmd/messages.c
+--- a/crm/crmd/messages.c      Thu Jan 11 18:42:41 2007 -0700
++++ b/crm/crmd/messages.c      Fri Feb 09 15:05:30 2007 +0100
+@@ -314,9 +314,7 @@ delete_fsa_input(fsa_data_t *fsa_data)
+                       case fsa_dt_ccm:
+                               ccm_input = (struct crmd_ccm_data_s *)
+                                       fsa_data->data;
+-
+-                              crm_free(ccm_input->oc);
+-                              crm_free(ccm_input);
++                              delete_ccm_data(ccm_input);
+                               break;
+                               
+                       case fsa_dt_none:
+diff -r 2d298bca0d0a crm/crmd/utils.c
+--- a/crm/crmd/utils.c Thu Jan 11 18:42:41 2007 -0700
++++ b/crm/crmd/utils.c Fri Feb 09 15:05:30 2007 +0100
+@@ -1151,6 +1148,42 @@ copy_ccm_data(const struct crmd_ccm_data
+       ccm_input_copy->event = ccm_input->event;
+       
+       return ccm_input_copy;
++}
++
++void
++delete_ccm_data(struct crmd_ccm_data_s *ccm_input) 
++{
++      int lpc, offset = 0;
++      oc_node_t *a_node = NULL;
++      oc_ev_membership_t *oc_in = ccm_input->oc;
++      if(oc_in != NULL) {
++              offset = oc_in->m_memb_idx;
++      }
++      for(lpc = 0; lpc < oc_in->m_n_member; lpc++) {
++              a_node = &oc_in->m_array[lpc+offset];
++              crm_free(a_node->node_uname);
++              a_node->node_uname = NULL;
++      }
++
++      if(oc_in != NULL) {
++              offset = oc_in->m_in_idx;
++      }
++      for(lpc = 0; lpc < oc_in->m_n_in; lpc++) {
++              a_node = &oc_in->m_array[lpc+offset];
++              crm_free(a_node->node_uname);
++              a_node->node_uname = NULL;
++      }
++
++      if(oc_in != NULL) {
++              offset = oc_in->m_out_idx;
++      }
++      for(lpc = 0; lpc < oc_in->m_n_out; lpc++) {
++              a_node = &oc_in->m_array[lpc+offset];
++              crm_free(a_node->node_uname);
++              a_node->node_uname = NULL;
++      }
++      crm_free(ccm_input->oc);
++      crm_free(ccm_input);
+ }
+ oc_ev_membership_t *
+@@ -1243,21 +1274,61 @@ copy_ccm_node(oc_node_t a_node, oc_node_
+                 a_node.node_id, a_node.node_born_on,
+                 a_node.node_uname);
+       
++      if(a_node_copy->node_uname != NULL) {
++              crm_debug_2("%p (%s) already copied", a_node_copy, a_node_copy->node_uname);
++              return;
++      }
++
+       a_node_copy->node_id      = a_node.node_id;
+-      a_node_copy->node_born_on = a_node.node_born_on;        
++      a_node_copy->node_born_on = a_node.node_born_on;
+       a_node_copy->node_uname   = NULL;
+       
+       if(a_node.node_uname != NULL) {
+-                      a_node_copy->node_uname =
+-                              crm_strdup(a_node.node_uname);
++              a_node_copy->node_uname = crm_strdup(a_node.node_uname);
+       } else {
+-              crm_err("Node Id %d had a NULL uname!",
+-                      a_node.node_id);
+-      }
+-      
++              crm_err("Node Id %d had a NULL uname!", a_node.node_id);
++      }
+       crm_debug_3("Copied ccm node: id=%d, born=%d, uname=%s",
+                 a_node_copy->node_id, a_node_copy->node_born_on,
+                 a_node_copy->node_uname);
++}
++
++static gboolean
++ghash_node_clfree(gpointer key, gpointer value, gpointer user_data)
++{
++      /* value->node_uname is free'd as "key" */
++      if(key != NULL) {
++              crm_free(key);
++      }
++      if(value != NULL) {
++              crm_free(value);
++      }
++      return TRUE;
++}
++
++void
++free_ccm_cache(oc_node_list_t *tmp) 
++{
++      /* Free the old copy */
++      if(tmp == NULL) {
++              return;
++      }
++      
++      if(tmp->members != NULL) {
++              g_hash_table_foreach_remove(
++                      tmp->members, ghash_node_clfree, NULL);
++      }
++      if(tmp->new_members != NULL) {
++              g_hash_table_foreach_remove(
++                      tmp->new_members, ghash_node_clfree, NULL);
++      }
++      if(tmp->dead_members != NULL) {
++              g_hash_table_foreach_remove(
++                      tmp->dead_members, ghash_node_clfree, NULL);
++      }
++      
++      crm_free(tmp);
++      crm_debug_3("Free'd old copies");
+ }
+ crm_data_t*
+diff -r 2d298bca0d0a lib/crm/cib/cib_attrs.c
+--- a/lib/crm/cib/cib_attrs.c  Thu Jan 11 18:42:41 2007 -0700
++++ b/lib/crm/cib/cib_attrs.c  Fri Feb 09 15:05:30 2007 +0100
+@@ -101,7 +101,9 @@ find_attr_details(crm_data_t *xml_search
+                       NULL, XML_ATTR_ID, node_uuid, FALSE);
+               crm_log_xml_debug_2(set_children, "search by node:");
+               if(matches == 0) {
+-                      crm_info("No node matching id=%s in %s", node_uuid, TYPE(xml_search));
++                      CRM_CHECK(set_children == NULL, crm_err("Memory leak"));
++                      crm_info("No node matching id=%s in %s",
++                               node_uuid, TYPE(xml_search));
+                       return NULL;
+               }
+       }
+@@ -114,6 +116,7 @@ find_attr_details(crm_data_t *xml_search
+               crm_log_xml_debug_2(set_children, "search by set:");
+               if(matches == 0) {
+                       crm_info("No set matching id=%s in %s", set_name, TYPE(xml_search));
++                      CRM_CHECK(set_children == NULL, crm_err("Memory leak"));
+                       return NULL;
+               }
+       }
+@@ -140,6 +143,7 @@ find_attr_details(crm_data_t *xml_search
+                              break;
+                       );
+               free_xml(nv_children);
++              free_xml(set_children);
+               return single_match;
+               
+       } else if(matches > 1) {
+@@ -176,6 +180,7 @@ find_attr_details(crm_data_t *xml_search
+                               );
+               }
+       }
++      free_xml(set_children);
+       return NULL;
+ }
+@@ -230,6 +235,7 @@ update_attr(cib_t *the_cib, int call_opt
+               CRM_CHECK(set_name != NULL, return cib_missing);
+               
+               if(attr_value == NULL) {
++                      free_xml(xml_obj);
+                       return cib_missing_data;
+               }
+               
+@@ -264,6 +270,7 @@ update_attr(cib_t *the_cib, int call_opt
+               xml_obj = create_xml_node(xml_obj, XML_TAG_ATTRS);
+               crm_free(local_set_name);
+       } else {
++              free_xml(xml_obj);
+               xml_obj = NULL;
+       }
+diff -r 2d298bca0d0a lib/crm/cib/cib_client.c
+--- a/lib/crm/cib/cib_client.c Thu Jan 11 18:42:41 2007 -0700
++++ b/lib/crm/cib/cib_client.c Fri Feb 09 15:05:30 2007 +0100
+@@ -487,7 +487,8 @@ int cib_client_add_notify_callback(
+       
+       if(list_item != NULL) {
+               crm_warn("Callback already present");
+-
++              crm_free(new_client);
++              
+       } else {
+               cib->notify_list = g_list_append(
+                       cib->notify_list, new_client);
+diff -r 2d298bca0d0a lib/crm/common/utils.c
+--- a/lib/crm/common/utils.c   Thu Jan 11 18:42:41 2007 -0700
++++ b/lib/crm/common/utils.c   Fri Feb 09 15:05:30 2007 +0100
+@@ -519,6 +519,7 @@ int
+ int
+ compare_version(const char *version1, const char *version2)
+ {
++      int rc = 0;
+       int lpc = 0;
+       char *step1 = NULL, *step2 = NULL;
+       char *rest1 = NULL, *rest2 = NULL;
+@@ -533,7 +534,7 @@ compare_version(const char *version1, co
+       
+       rest1 = crm_strdup(version1);
+       rest2 = crm_strdup(version2);
+-      
++
+       while(1) {
+               int cmp = 0;
+               int step1_i = 0;
+@@ -543,6 +544,13 @@ compare_version(const char *version1, co
+               decodeNVpair(rest1, '.', &step1, &tmp1);
+               decodeNVpair(rest2, '.', &step2, &tmp2);
++              if(step1 == NULL && step2 == NULL) {
++                      CRM_CHECK(tmp1 == tmp2 && tmp1 == NULL,
++                                crm_err("Leftover data: %s, %s",
++                                        crm_str(tmp1), crm_str(tmp2)));
++                      break;
++              }
++              
+               if(step1 != NULL) {
+                       step1_i = crm_parse_int(step1, NULL);
+               }
+@@ -564,27 +572,34 @@ compare_version(const char *version1, co
+               crm_free(rest1);
+               crm_free(rest2);
++              crm_free(step1);
++              crm_free(step2);
++
+               rest1 = tmp1;
+               rest2 = tmp2;
+-
+-              if(step1 == NULL && step2 == NULL) {
++              
++              if(cmp < 0) {
++                      rc = -1;
+                       break;
+-              }
+-
+-              crm_free(step1);
+-              crm_free(step2);
+-              
+-              if(cmp < 0) {
+-                      crm_debug_3("%s < %s", version1, version2);
+-                      return -1;
+                       
+               } else if(cmp > 0) {
+-                      crm_debug_3("%s > %s", version1, version2);
+-                      return 1;
+-              }
+-      }
+-      crm_debug_3("%s == %s", version1, version2);
+-      return 0;
++                      rc = 1;
++                      break;
++              }
++      }
++      
++      crm_free(rest1);
++      crm_free(rest2);
++
++      if(rc == 0) {
++              crm_debug_3("%s == %s", version1, version2);
++      } else if(rc < 0) {
++              crm_debug_3("%s < %s", version1, version2);
++      } else if(rc > 0) {
++              crm_debug_3("%s > %s", version1, version2);
++      }
++      
++      return rc;
+ }
+ gboolean do_stderr = FALSE;
+diff -r 2d298bca0d0a lib/crm/common/xml.c
+--- a/lib/crm/common/xml.c     Thu Jan 11 18:42:41 2007 -0700
++++ b/lib/crm/common/xml.c     Fri Feb 09 15:05:30 2007 +0100
+@@ -2500,13 +2500,13 @@ validate_with_dtd(
+       CRM_CHECK(buffer != NULL, return FALSE);
+       doc = xmlParseMemory(buffer, strlen(buffer));
+-      CRM_CHECK(doc != NULL, crm_free(buffer); return FALSE);
++      CRM_CHECK(doc != NULL, valid = FALSE; goto cleanup);
+       
+       dtd = xmlParseDTD(NULL, (const xmlChar *)dtd_file);
+-      CRM_CHECK(dtd != NULL, crm_free(buffer); return TRUE);
++      CRM_CHECK(dtd != NULL, goto cleanup);
+       cvp = xmlNewValidCtxt();
+-      CRM_CHECK(cvp != NULL, crm_free(buffer); return TRUE);
++      CRM_CHECK(cvp != NULL, goto cleanup);
+       if(to_logs) {
+               cvp->userData = (void *) LOG_ERR;
+@@ -2520,15 +2520,16 @@ validate_with_dtd(
+       
+       if (!xmlValidateDtd(cvp, doc, dtd)) {
+               crm_err("CIB does not validate against %s", dtd_file);
++              crm_log_xml_debug(xml_blob, "invalid");
+               valid = FALSE;
+-              crm_log_xml_debug(xml_blob, "invalid");
+-      }
+-
++      }
++      
++  cleanup:
+       xmlFreeValidCtxt(cvp);
+       xmlFreeDtd(dtd);
+       xmlFreeDoc(doc);
+-      
+       crm_free(buffer);
++      
+ #endif        
+       return valid;
+ }
+diff -r 2d298bca0d0a tools/attrd.c
+--- a/tools/attrd.c    Thu Jan 11 18:42:41 2007 -0700
++++ b/tools/attrd.c    Fri Feb 09 15:05:30 2007 +0100
+@@ -85,6 +85,7 @@ free_hash_entry(gpointer data)
+       }       
+       crm_free(entry->id);
+       crm_free(entry->set);
++      crm_free(entry->dampen);
+       crm_free(entry->section);
+       if(entry->value != entry->last_value) {
+               crm_free(entry->value);
+@@ -477,6 +489,7 @@ find_hash_entry(HA_Message * msg)
+       value = ha_msg_value(msg, F_ATTRD_SET);
+       if(value != NULL) {
++              crm_free(hash_entry->set);
+               hash_entry->set = crm_strdup(value);
+               crm_debug("\t%s->set: %s", attr, value);
+       }
+@@ -485,12 +498,15 @@ find_hash_entry(HA_Message * msg)
+       if(value == NULL) {
+               value = XML_CIB_TAG_STATUS;
+       }
++      crm_free(hash_entry->section);
+       hash_entry->section = crm_strdup(value);
+       crm_debug("\t%s->section: %s", attr, value);
+       
+       value = ha_msg_value(msg, F_ATTRD_DAMPEN);
+       if(value != NULL) {
++              crm_free(hash_entry->dampen);
+               hash_entry->dampen = crm_strdup(value);
++
+               hash_entry->timeout = crm_get_msec(value);
+               crm_debug("\t%s->timeout: %s", attr, value);
+       }
+@@ -601,6 +617,7 @@ attrd_timer_callback(void *user_data)
+       ha_msg_add(msg, F_ATTRD_SECTION, hash_entry->section);
+       ha_msg_add(msg, F_ATTRD_DAMPEN, hash_entry->dampen);
+       send_ha_message(attrd_cluster_conn, msg, NULL, FALSE);
++      crm_msg_del(msg);
+       
+       return TRUE;
+ }
index 2ea8804f71b96702da2de3542680d2897c95d602..57932fd152e77fa7084e853103c6013cc19479ca 100644 (file)
@@ -1,6 +1,6 @@
-# Copyright 1999-2006 Gentoo Foundation
+# Copyright 1999-2007 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-cluster/heartbeat/heartbeat-2.0.7-r2.ebuild,v 1.2 2006/09/25 23:57:35 xmerlin Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/heartbeat/heartbeat-2.0.7-r2.ebuild,v 1.3 2007/02/28 17:29:28 xmerlin Exp $
 
 inherit flag-o-matic eutils
 
@@ -47,6 +47,7 @@ src_unpack() {
        unpack ${A}
        cd ${S}
        epatch ${FILESDIR}/${P}-update-resources-failcount.patch || die
+       #epatch ${FILESDIR}/${P}-crm-leaks.patch || die
 }
 
 src_compile() {
diff --git a/sys-cluster/heartbeat/heartbeat-2.0.8.ebuild b/sys-cluster/heartbeat/heartbeat-2.0.8.ebuild
new file mode 100644 (file)
index 0000000..2b94095
--- /dev/null
@@ -0,0 +1,120 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-cluster/heartbeat/heartbeat-2.0.8.ebuild,v 1.1 2007/02/28 17:29:28 xmerlin Exp $
+
+inherit flag-o-matic eutils
+
+DESCRIPTION="Heartbeat high availability cluster manager"
+HOMEPAGE="http://www.linux-ha.org"
+SRC_URI="http://www.linux-ha.org/download/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 -mips ~ppc -s390 ~x86"
+IUSE="ldirectord doc snmp management"
+
+DEPEND="
+       =dev-libs/glib-2*
+       net-libs/libnet
+       dev-util/pkgconfig
+       >=dev-lang/perl-5.8.8
+       net-misc/iputils
+       virtual/ssh
+       net-libs/gnutls
+       ldirectord? (   sys-cluster/ipvsadm
+                       dev-perl/Net-DNS
+                       dev-perl/libwww-perl
+                       dev-perl/perl-ldap
+                       perl-core/libnet
+                       dev-perl/Crypt-SSLeay
+                       dev-perl/HTML-Parser
+                       dev-perl/perl-ldap
+                       dev-perl/Mail-IMAPClient
+                       dev-perl/Mail-POP3Client
+                       dev-perl/MailTools
+       )
+       snmp? ( net-analyzer/net-snmp )
+       net-misc/telnet-bsd
+       dev-lang/swig
+       management? (
+               >=dev-lang/python-2.4
+               >=dev-python/pygtk-2.4
+               >=sys-libs/pam-0.78-r3
+       )
+       "
+
+src_unpack() {
+       unpack ${A}
+       cd ${S}
+       #epatch ${FILESDIR}/${P}-update-resources-failcount.patch || die
+       epatch ${FILESDIR}/${P}-crm-leaks.patch || die
+}
+
+src_compile() {
+       append-ldflags $(bindnow-flags)
+
+       ./configure --prefix=/usr \
+               --mandir=/usr/share/man \
+               --sysconfdir=/etc \
+               --localstatedir=/var \
+               --with-group-name=cluster \
+               --with-group-id=65 \
+               --with-ccmuser-name=cluster \
+               --with-ccmuser-id=65 \
+               --enable-checkpointd \
+               --enable-crm \
+               --enable-lrm \
+               $(use_enable management mgmt) \
+               || die
+       emake -j 1 || die "compile problem"
+}
+
+pkg_preinst() {
+       # check for cluster group, if it doesn't exist make it
+       if ! grep -q cluster.*65 /etc/group ; then
+               groupadd -g 65 cluster
+       fi
+       # check for cluster user, if it doesn't exist make it
+       if ! grep -q cluster.*65 /etc/passwd ; then
+               useradd -u 65 -g cluster -s /dev/null -d /var/lib/heartbeat cluster
+       fi
+}
+
+src_install() {
+       make DESTDIR=${D} install || die
+
+       # heartbeat modules need these dirs
+       #keepdir /var/lib/heartbeat/ckpt /var/lib/heartbeat/ccm /var/lib/heartbeat
+
+       keepdir /var/lib/heartbeat/crm /var/lib/heartbeat/lrm /var/lib/heartbeat/fencing
+       keepdir /var/lib/heartbeat/cores/cluster /var/lib/heartbeat/cores/root /var/lib/heartbeat/cores/nobody
+
+       keepdir /var/run/heartbeat/ccm /var/run/heartbeat/crm
+
+       keepdir /etc/ha.d/conf
+
+       dosym /usr/sbin/ldirectord /etc/ha.d/resource.d/ldirectord || die
+
+       if use management ; then
+               keepdir /var/lib/heartbeat/mgmt
+       fi
+
+       # if ! USE="ldirectord" then don't install it
+       if ! use ldirectord ; then
+               rm ${D}/etc/init.d/ldirectord
+               rm ${D}/etc/logrotate.d/ldirectord
+               rm ${D}/etc/ha.d/resource.d/ldirectord
+               rm ${D}/usr/share/man/man8/supervise-ldirectord-config.8
+               rm ${D}/usr/share/man/man8/ldirectord.8
+               rm ${D}/usr/sbin/ldirectord
+               rm ${D}/usr/sbin/supervise-ldirectord-config
+       fi
+
+       exeinto /etc/init.d
+       newexe ${FILESDIR}/heartbeat-init heartbeat
+
+       dodoc ldirectord/ldirectord.cf doc/*.cf doc/haresources doc/authkeys || die
+       if use doc ; then
+               dodoc README doc/*.txt doc/AUTHORS doc/COPYING  || die
+       fi
+}