avoid 0 byte malloc.
This commit was SVN r17653.
Этот коммит содержится в:
родитель
8d819cf3d3
Коммит
2b5fab9d51
@ -139,11 +139,15 @@ int setup_multinomial_tree(int tree_order, int num_nodes,
|
||||
}
|
||||
}
|
||||
tree_nodes[node_index].n_children=n_children;
|
||||
if( 0 < n_children ) {
|
||||
tree_nodes[node_index].children_ranks=(int *)
|
||||
malloc(sizeof(int)*n_children);
|
||||
if( NULL == tree_nodes[node_index].children_ranks) {
|
||||
goto Error;
|
||||
}
|
||||
} else {
|
||||
tree_nodes[node_index].children_ranks=NULL;
|
||||
}
|
||||
/* fill in list */
|
||||
for( rank=0 ; rank < n_children ; rank++ ) {
|
||||
tree_nodes[node_index].children_ranks[rank]=
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user