1
1

opal/sys_limits: fix coverity issue

CID 996175 Dereference before null check (REVERSE_NULL)

If lims is NULL then we ran out of memory. Return an error and remove
the NULL check at cleanup.

Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
Этот коммит содержится в:
Nathan Hjelm 2015-05-27 13:39:42 -06:00
родитель 3edb421adc
Коммит 0e3c32a98a

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
* University Research and Technology
@ -10,8 +11,8 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2013-2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2014 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
@ -119,6 +120,9 @@ int opal_util_init_sys_limits(char **errmsg)
/* parse the requested limits to set */
lims = opal_argv_split(opal_set_max_sys_limits, ',');
if (NULL == lims) {
return OPAL_ERR_OUT_OF_RESOURCE;
}
/* each limit is expressed as a "param:value" pair */
for (i=0; NULL != lims[i]; i++) {
@ -223,9 +227,7 @@ int opal_util_init_sys_limits(char **errmsg)
rc = OPAL_SUCCESS;
out:
if (NULL != lims) {
opal_argv_free(lims);
}
opal_argv_free(lims);
if (NULL != lim) {
opal_argv_free(lim);
}