heimbase-atomics: fix heim_base_atomic_* on AIX
The API looks like this on AIX: typedef int *atomic_p; int fetch_and_add(atomic_p addr, int value); The strange thing is that the xlc compiler ignores missing arguments by default. (It warns but doesn't fail to compile) As a result the value argument was just uninitialized memory, which means that the ref_cnt variable of struct heim_base, gets unpredictable values during heim_retain() and heim_release(), resulting in memory leaks. Signed-off-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:

committed by
Luke Howard

parent
131d90c414
commit
1e5cb64569
@@ -103,10 +103,10 @@
|
||||
|
||||
#define heim_base_atomic_barrier() __isync()
|
||||
|
||||
#define heim_base_atomic_inc(x) (fetch_and_add((atomic_p)(x)) + 1)
|
||||
#define heim_base_atomic_dec(x) (fetch_and_add((atomic_p)(x)) - 1)
|
||||
#define heim_base_atomic_integer_type unsigned int
|
||||
#define heim_base_atomic_integer_max UINT_MAX
|
||||
#define heim_base_atomic_inc(x) (fetch_and_add((atomic_p)(x), 1) + 1)
|
||||
#define heim_base_atomic_dec(x) (fetch_and_add((atomic_p)(x), -1) - 1)
|
||||
#define heim_base_atomic_integer_type int
|
||||
#define heim_base_atomic_integer_max INT_MAX
|
||||
|
||||
static inline void *
|
||||
heim_base_exchange_pointer(void *p, void *newval)
|
||||
|
Reference in New Issue
Block a user