]> git.mxchange.org Git - simgear.git/commitdiff
Modified Files:
authorfrohlich <frohlich>
Sun, 28 Jan 2007 20:03:43 +0000 (20:03 +0000)
committerfrohlich <frohlich>
Sun, 28 Jan 2007 20:03:43 +0000 (20:03 +0000)
simgear/structure/SGAtomic.cxx: Plug memory leak originating from
wrong atomic fallback operations.

simgear/structure/SGAtomic.cxx

index 3505fabf601b2c9ca57eccf0f8e6f48ea3285b51..9eabf4ec816719557daa2c42ae9830e3f4845a95 100644 (file)
@@ -39,7 +39,7 @@ unsigned __sync_sub_and_fetch_4(volatile void *ptr, unsigned value)
                        : "=r" (result), "=m" (*mem)
                        : "0" (-value), "m" (*mem)
                        : "memory");
-  return result;
+  return result - value;
 }
 
 unsigned __sync_add_and_fetch_4(volatile void *ptr, unsigned value)
@@ -50,7 +50,7 @@ unsigned __sync_add_and_fetch_4(volatile void *ptr, unsigned value)
                        : "=r" (result), "=m" (*mem)
                        : "0" (value), "m" (*mem)
                        : "memory");
-  return result;
+  return result + value;
 }
 
 void __sync_synchronize()