From b70dd1bcf9567b555992cc27c307e6a5ebd6eb49 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Sun, 13 Sep 2015 13:14:13 +0300 Subject: [PATCH] [fbreader] Fixed incorrect use of atomic builtins Which resulted in memory leaks --- fbreader/fbreader/zlibrary/core/src/util/shared_ptr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fbreader/fbreader/zlibrary/core/src/util/shared_ptr.h b/fbreader/fbreader/zlibrary/core/src/util/shared_ptr.h index 6980967..221fce1 100644 --- a/fbreader/fbreader/zlibrary/core/src/util/shared_ptr.h +++ b/fbreader/fbreader/zlibrary/core/src/util/shared_ptr.h @@ -196,7 +196,7 @@ template inline unsigned int shared_ptr_storage::removeWeakReference() { #if FBREADER_USE_GNUC_SYNC_BUILTINS __sync_fetch_and_sub(&myWeakCounter, 1); - return __sync_add_and_fetch(&myTotalCount, 1); + return __sync_sub_and_fetch(&myTotalCount, 1); #else --myWeakCounter; return counter();