Skip to content

Commit

Permalink
Merge pull request #15 from jsquyres/topic/memcheker-calloc
Browse files Browse the repository at this point in the history
memchecker: per RFC, use calloc for OBJ_NEW
  • Loading branch information
rhc54 committed Oct 23, 2014
2 parents 1c03c0d + 3156f98 commit 978d1a8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion opal/class/opal_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* 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) 2007-2014 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -464,7 +464,11 @@ static inline opal_object_t *opal_obj_new(opal_class_t * cls)
opal_object_t *object;
assert(cls->cls_sizeof >= sizeof(opal_object_t));

#if OPAL_WANT_MEMCHECKER
object = (opal_object_t *) calloc(1, cls->cls_sizeof);
#else
object = (opal_object_t *) malloc(cls->cls_sizeof);
#endif
if (0 == cls->cls_initialized) {
opal_class_initialize(cls);
}
Expand Down
4 changes: 2 additions & 2 deletions opal/mca/memchecker/valgrind/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Copyright (c) 2004-2008 High Performance Computing Center Stuttgart,
# University of Stuttgart. All rights reserved.
# Copyright (c) 2008-2010 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2008-2014 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand Down Expand Up @@ -45,7 +45,7 @@ AC_DEFUN([MCA_opal_memchecker_valgrind_CONFIG],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include "valgrind/memcheck.h"
]],
[[char buffer = 0xff;
[[char buffer = 0x0f;
VALGRIND_CHECK_MEM_IS_ADDRESSABLE(&buffer, sizeof(buffer));]])],
[AC_MSG_RESULT([yes])
opal_memchecker_valgrind_happy=yes],
Expand Down

0 comments on commit 978d1a8

Please sign in to comment.