Commit f602ff4b authored by Sumit Narayan's avatar Sumit Narayan
Browse files

Patch from Jerome Soumagne to fix segfaults, memory leaks and build issues on OSX.

parent 3e288f56
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
* See COPYING in top-level directory. * See COPYING in top-level directory.
*/ */
#include "pint-mem.h"
#define _XOPEN_SOURCE 600 #define _XOPEN_SOURCE 600
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
......
...@@ -7,8 +7,10 @@ ...@@ -7,8 +7,10 @@
#ifndef __PINT_MEM_H #ifndef __PINT_MEM_H
#define __PINT_MEM_H #define __PINT_MEM_H
extern void* PINT_mem_aligned_alloc(size_t size, size_t alignment); #include <stddef.h>
extern void PINT_mem_aligned_free(void *ptr);
void* PINT_mem_aligned_alloc(size_t size, size_t alignment);
void PINT_mem_aligned_free(void *ptr);
#endif /* __PINT_MEM_H */ #endif /* __PINT_MEM_H */
......
...@@ -529,6 +529,10 @@ int BMI_finalize(void) ...@@ -529,6 +529,10 @@ int BMI_finalize(void)
} }
gen_mutex_unlock(&bmi_initialize_mutex); gen_mutex_unlock(&bmi_initialize_mutex);
/* destroy the reference list */
/* (side effect: destroys all method addresses as well) */
// ref_list_cleanup(cur_ref_list);
gen_mutex_lock(&active_method_count_mutex); gen_mutex_lock(&active_method_count_mutex);
/* attempt to shut down active methods */ /* attempt to shut down active methods */
for (i = 0; i < active_method_count; i++) for (i = 0; i < active_method_count; i++)
...@@ -548,10 +552,6 @@ int BMI_finalize(void) ...@@ -548,10 +552,6 @@ int BMI_finalize(void)
if (unexpected_method_usage) if (unexpected_method_usage)
free(unexpected_method_usage); free(unexpected_method_usage);
/* destroy the reference list */
/* (side effect: destroys all method addresses as well) */
ref_list_cleanup(cur_ref_list);
/* shut down id generator */ /* shut down id generator */
id_gen_safe_finalize(); id_gen_safe_finalize();
......
...@@ -568,6 +568,9 @@ int BMI_tcp_finalize(void) ...@@ -568,6 +568,9 @@ int BMI_tcp_finalize(void)
tcp_socket_collection_p = NULL; tcp_socket_collection_p = NULL;
} }
/* free hash table storing method addresses */
qhash_finalize(addr_hash_table);
/* NOTE: we are trusting the calling BMI layer to deallocate /* NOTE: we are trusting the calling BMI layer to deallocate
* all of the method addresses (this will close any open sockets) * all of the method addresses (this will close any open sockets)
*/ */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment