aboutsummaryrefslogtreecommitdiff
path: root/libobjc/sarray.c
diff options
context:
space:
mode:
authorAndrew Ruder <aeruder@ksu.edu>2004-01-10 05:47:42 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2004-01-09 21:47:42 -0800
commitb39f1868240db95ac3ffa7239cb28cfa1d65f065 (patch)
tree419424213290780261e61d34372cbb43fd5f3c70 /libobjc/sarray.c
parentf01519dd00355e65f34b40acc82457dcdeedf3d6 (diff)
downloadgcc-b39f1868240db95ac3ffa7239cb28cfa1d65f065.zip
gcc-b39f1868240db95ac3ffa7239cb28cfa1d65f065.tar.gz
gcc-b39f1868240db95ac3ffa7239cb28cfa1d65f065.tar.bz2
re PR libobjc/11904 (Problem in sarray_free() function.)
2004-01-09 Andrew Ruder <aeruder@ksu.edu> PR libobjc/11904 * sarray.c (sarray_free): Free array->is_copy_of latter. From-SVN: r75630
Diffstat (limited to 'libobjc/sarray.c')
-rw-r--r--libobjc/sarray.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libobjc/sarray.c b/libobjc/sarray.c
index 71202cb..c37633b 100644
--- a/libobjc/sarray.c
+++ b/libobjc/sarray.c
@@ -402,9 +402,6 @@ sarray_free (struct sarray *array) {
#else
old_buckets = array->buckets;
#endif
-
- if ((array->is_copy_of) && ((array->is_copy_of->ref_count - 1) == 0))
- sarray_free (array->is_copy_of);
/* Free all entries that do not point to empty_bucket */
for (counter = 0; counter <= old_max_index; counter++ ) {
@@ -462,6 +459,10 @@ sarray_free (struct sarray *array) {
#endif
+ /* If this is a copy, go ahead and decrement/deallocate the original */
+ if (array->is_copy_of)
+ sarray_free (array->is_copy_of);
+
/* free array */
sarray_free_garbage (array);
}