summaryrefslogtreecommitdiff
path: root/daemons/clvmd/clvmd-cman.c
diff options
context:
space:
mode:
authorChristine Caulfield <ccaulfie@redhat.com>2008-03-25 10:41:59 +0000
committerChristine Caulfield <ccaulfie@redhat.com>2008-03-25 10:41:59 +0000
commit7750a1ade6c774f00001ad1e344a8307e75b90bc (patch)
treec1f32a5ca4754a9fbe92b7cb32acb0431bae25df /daemons/clvmd/clvmd-cman.c
parentc206c19c1914d605c8acbd3fde46d52a30cc7b51 (diff)
downloadlvm2-7750a1ade6c774f00001ad1e344a8307e75b90bc.tar.gz
When reallocating the node IDs array, make it bigger rather than smaller!
Diffstat (limited to 'daemons/clvmd/clvmd-cman.c')
-rw-r--r--daemons/clvmd/clvmd-cman.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/daemons/clvmd/clvmd-cman.c b/daemons/clvmd/clvmd-cman.c
index 697305dcb..47cc4a9b7 100644
--- a/daemons/clvmd/clvmd-cman.c
+++ b/daemons/clvmd/clvmd-cman.c
@@ -241,7 +241,7 @@ static void _add_up_node(const char *csid)
if (nodeid >= max_updown_nodes) {
int new_size = nodeid + 10;
- int *new_updown = realloc(node_updown, new_size);
+ int *new_updown = realloc(node_updown, sizeof(int) * new_size);
if (new_updown) {
node_updown = new_updown;
@@ -326,7 +326,10 @@ static void get_members()
}
if (node_updown == NULL) {
- size_t buf_len = sizeof(int) * max(num_nodes, max_updown_nodes);
+ size_t buf_len;
+ if (num_nodes > max_updown_nodes)
+ max_updown_nodes = num_nodes;
+ buf_len = sizeof(int) * max_updown_nodes;
node_updown = malloc(buf_len);
if (node_updown)
memset(node_updown, 0, buf_len);