1
1

Merge pull request #6336 from jsquyres/pr/v4.0.x/fix-datatype-destructor-leak

v4.0.x: opal/datatype: plug a memory leak in opal_datatype_t destructor
Этот коммит содержится в:
Howard Pritchard 2019-02-11 13:14:06 -07:00 коммит произвёл GitHub
родитель 8552d0e608 0ae48475a1
Коммит 9e306cee49
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 6 добавлений и 1 удалений

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

@ -12,6 +12,8 @@
* All rights reserved. * All rights reserved.
* Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -41,6 +43,7 @@ int32_t opal_datatype_clone( const opal_datatype_t * src_type, opal_datatype_t *
sizeof(opal_datatype_t)-sizeof(opal_object_t) ); sizeof(opal_datatype_t)-sizeof(opal_object_t) );
dest_type->flags &= (~OPAL_DATATYPE_FLAG_PREDEFINED); dest_type->flags &= (~OPAL_DATATYPE_FLAG_PREDEFINED);
dest_type->ptypes = NULL;
dest_type->desc.desc = temp; dest_type->desc.desc = temp;
/** /**

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

@ -11,6 +11,8 @@
* Copyright (c) 2004-2006 The Regents of the University of California. * Copyright (c) 2004-2006 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. * Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
* Copyright (c) 2019 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* $COPYRIGHT$ * $COPYRIGHT$
* *
* Additional copyrights may follow * Additional copyrights may follow
@ -77,7 +79,7 @@ static void opal_datatype_destruct( opal_datatype_t* datatype )
} }
} }
/* dont free the ptypes of predefined types (it was not dynamically allocated) */ /* dont free the ptypes of predefined types (it was not dynamically allocated) */
if( (NULL != datatype->ptypes) && (datatype->id >= OPAL_DATATYPE_MAX_PREDEFINED) ) { if( (NULL != datatype->ptypes) && (!opal_datatype_is_predefined(datatype)) ) {
free(datatype->ptypes); free(datatype->ptypes);
datatype->ptypes = NULL; datatype->ptypes = NULL;
} }