1
1

Fix the allocation for the pointers to the btl structures.

We were only allocating one whereas we would typically need
one per interface.  Most of the time we got lucky and we 
happily trundled over unallocated memory.  But with enough
interfaces, we would get a SEGV.

Also add include to fix compilation with static libs.

This commit was SVN r19845.
Этот коммит содержится в:
Rolf vandeVaart 2008-10-29 15:15:37 +00:00
родитель 5f4d081fef
Коммит 95bf870055
2 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -10,6 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -492,8 +493,12 @@ static int mca_btl_sctp_component_create_instance(void)
return OMPI_ERROR; return OMPI_ERROR;
} }
/* allocate memory for btl */ /* Allocate memory for btl pointers. This may be more space then
mca_btl_sctp_component.sctp_btls = (mca_btl_sctp_module_t **)malloc(sizeof(mca_btl_sctp_module_t*)); we need as some of the interfaces may get filtered out by the
if_include and if_exclude parameters. But that is just a few
unused pointers. */
mca_btl_sctp_component.sctp_btls =
(mca_btl_sctp_module_t **)malloc(if_count * sizeof(mca_btl_sctp_module_t*));
if(NULL == mca_btl_sctp_component.sctp_btls) { if(NULL == mca_btl_sctp_component.sctp_btls) {
return OMPI_ERR_OUT_OF_RESOURCE; return OMPI_ERR_OUT_OF_RESOURCE;
} }

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -23,6 +24,7 @@
#include "btl_sctp_utils.h" #include "btl_sctp_utils.h"
#include "ompi/mca/btl/base/btl_base_error.h"
/** /**
* struct sockaddr_in mca_btl_sctp_utils_sockaddr_from_frag * struct sockaddr_in mca_btl_sctp_utils_sockaddr_from_frag