Mercurial > MadButterfly
comparison nodejs/coord.cc @ 768:13669b28826d
Fix issue of memory leaking for coord objects.
When coord.cc try to release memory of coords of a subtree, a typo
make the code always free root coord of the subtree. It causes a
leaking.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sun, 29 Aug 2010 17:20:13 +0800 |
parents | be0e02948c1d |
children | 61c217f8cec8 |
comparison
equal
deleted
inserted
replaced
767:9d430b084a13 | 768:13669b28826d |
---|---|
111 rdman_coord_changed(rdman, coord); | 111 rdman_coord_changed(rdman, coord); |
112 | 112 |
113 last_child = NULL; | 113 last_child = NULL; |
114 FOR_COORDS_POSTORDER(coord, child) { | 114 FOR_COORDS_POSTORDER(coord, child) { |
115 if(last_child != NULL) { | 115 if(last_child != NULL) { |
116 r = rdman_coord_free(rdman, coord); | 116 r = rdman_coord_free(rdman, last_child); |
117 if(r != OK) | 117 if(r != OK) |
118 THROW_noret("Unknown error"); | 118 THROW_noret("Unknown error"); |
119 } | 119 } |
120 | 120 |
121 /* Free members of a coord */ | 121 /* Free members of a coord */ |
136 } | 136 } |
137 | 137 |
138 last_child = child; | 138 last_child = child; |
139 } | 139 } |
140 if(last_child != NULL) { | 140 if(last_child != NULL) { |
141 r = rdman_coord_free(rdman, coord); | 141 r = rdman_coord_free(rdman, last_child); |
142 if(r != OK) | 142 if(r != OK) |
143 THROW_noret("Unknown error"); | 143 THROW_noret("Unknown error"); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |