[asterisk-commits] coreyfarrell: branch 13 r428273 - in /branches/13: ./ include/asterisk/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Nov 19 13:31:20 CST 2014


Author: coreyfarrell
Date: Wed Nov 19 13:31:13 2014
New Revision: 428273

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=428273
Log:
stringfields: Fix bug in ast_string_fields_copy.

ast_string_fields_copy relies on the fact that
__ast_string_field_release_active never previously
zeroed pool->used, so keeping the existing pointer
was "ok".  Now that existing pools can be reset to
'empty', it is important to set each field to
__ast_string_field_empty after releasing the memory.

ASTERISK-24535 #close
Reported by: Corey Farrell
Review: https://reviewboard.asterisk.org/r/4186/
........

Merged revisions 428272 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    branches/13/   (props changed)
    branches/13/include/asterisk/stringfields.h

Propchange: branches/13/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: branches/13/include/asterisk/stringfields.h
URL: http://svnview.digium.com/svn/asterisk/branches/13/include/asterisk/stringfields.h?view=diff&rev=428273&r1=428272&r2=428273
==============================================================================
--- branches/13/include/asterisk/stringfields.h (original)
+++ branches/13/include/asterisk/stringfields.h Wed Nov 19 13:31:13 2014
@@ -438,10 +438,11 @@
 	int __len__ = ((void *)&(copy)->__field_mgr - (void *)&(copy)->__field_mgr_pool)/__ptr_size__ - 1; \
 	int __len2__ = ((void *)&(orig)->__field_mgr - (void *)&(orig)->__field_mgr_pool)/__ptr_size__ - 1; \
 	if (__len__ == __len2__) { \
-		char **__copy_head__ = (void *)&(copy)->__field_mgr_pool + __ptr_size__; \
-		char **__orig_head__ = (void *)&(orig)->__field_mgr_pool + __ptr_size__; \
+		ast_string_field *__copy_head__ = (void *)&(copy)->__field_mgr_pool + __ptr_size__; \
+		ast_string_field *__orig_head__ = (void *)&(orig)->__field_mgr_pool + __ptr_size__; \
 		for (__len2__ -= 1; __len2__ >= 0; __len2__--) { \
 			__ast_string_field_release_active((copy)->__field_mgr_pool, __copy_head__[__len2__]); \
+			__copy_head__[__len2__] = __ast_string_field_empty; \
 		} \
 		for (__len__ -= 1; __len__ >= 0; __len__--) { \
 			if (ast_string_field_ptr_set((copy), &__copy_head__[__len__], __orig_head__[__len__])) { \




More information about the asterisk-commits mailing list