1
1

mtl/psm2: plug a memory leak in ompi_mtl_psm2_component_open()

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
Этот коммит содержится в:
Gilles Gouaillardet 2016-12-19 09:01:25 +09:00
родитель b343df43a1
Коммит 1daa80d78f

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

@ -14,6 +14,8 @@
* Copyright (c) 2012-2015 Los Alamos National Security, LLC. * Copyright (c) 2012-2015 Los Alamos National Security, LLC.
* All rights reserved. * All rights reserved.
* Copyright (c) 2013-2015 Intel, Inc. All rights reserved * Copyright (c) 2013-2015 Intel, Inc. All rights reserved
* Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -102,16 +104,24 @@ ompi_mtl_psm2_component_register(void)
static int static int
ompi_mtl_psm2_component_open(void) ompi_mtl_psm2_component_open(void)
{ {
int res;
glob_t globbuf; glob_t globbuf;
globbuf.gl_offs = 0; globbuf.gl_offs = 0;
/* Component available only if Omni-Path hardware is present */ /* Component available only if Omni-Path hardware is present */
if ((glob("/dev/hfi1_[0-9]", GLOB_DOOFFS, NULL, &globbuf) != 0) && res = glob("/dev/hfi1_[0-9]", GLOB_DOOFFS, NULL, &globbuf);
(glob("/dev/hfi1_[0-9][0-9]", GLOB_APPEND, NULL, &globbuf) != 0)) { if (0 == res || GLOB_NOMATCH == res) {
globfree(&globbuf);
}
if (0 != res) {
res = glob("/dev/hfi1_[0-9][0-9]", GLOB_APPEND, NULL, &globbuf);
if (0 == res || GLOB_NOMATCH == res) {
globfree(&globbuf);
}
if (0 != res) {
return OPAL_ERR_NOT_AVAILABLE; return OPAL_ERR_NOT_AVAILABLE;
} }
}
globfree(&globbuf);
/* Component available only if at least one hfi1 port is ACTIVE */ /* Component available only if at least one hfi1 port is ACTIVE */
bool foundOnlineHfi1Port = false; bool foundOnlineHfi1Port = false;