1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

When reallocating the node IDs array, make it bigger rather than smaller!

This commit is contained in:
Christine Caulfield 2008-03-25 10:41:59 +00:00
parent c206c19c19
commit 7750a1ade6
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.34 - Version 2.02.34 -
=================================== ===================================
clvmd no longer crashes if it sees nodeids over 50.
Fix potential deadlock in clvmd thread handling. Fix potential deadlock in clvmd thread handling.
Refactor text format initialisation into _init_text_import. Refactor text format initialisation into _init_text_import.
Escape double quotes and backslashes in external metadata and config data. Escape double quotes and backslashes in external metadata and config data.

View File

@ -241,7 +241,7 @@ static void _add_up_node(const char *csid)
if (nodeid >= max_updown_nodes) { if (nodeid >= max_updown_nodes) {
int new_size = nodeid + 10; 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) { if (new_updown) {
node_updown = new_updown; node_updown = new_updown;
@ -326,7 +326,10 @@ static void get_members()
} }
if (node_updown == NULL) { 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); node_updown = malloc(buf_len);
if (node_updown) if (node_updown)
memset(node_updown, 0, buf_len); memset(node_updown, 0, buf_len);