[asterisk-commits] file: branch group/media_formats r407182 - /team/group/media_formats/include/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 3 08:15:06 CST 2014
Author: file
Date: Mon Feb 3 08:15:03 2014
New Revision: 407182
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=407182
Log:
Use ast_calloc so newly created empty spots are, well, empty.
Modified:
team/group/media_formats/include/asterisk/vector.h
Modified: team/group/media_formats/include/asterisk/vector.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/include/asterisk/vector.h?view=diff&rev=407182&r1=407181&r2=407182
==============================================================================
--- team/group/media_formats/include/asterisk/vector.h (original)
+++ team/group/media_formats/include/asterisk/vector.h Mon Feb 3 08:15:03 2014
@@ -130,9 +130,12 @@
do { \
if ((idx + 1) > (vec)->max) { \
size_t new_max = (idx + 1) * 2; \
- typeof((vec)->elems) new_elems = ast_realloc( \
- (vec)->elems, new_max * sizeof(*new_elems)); \
+ typeof((vec)->elems) new_elems = ast_calloc(1, \
+ new_max * sizeof(*new_elems)); \
if (new_elems) { \
+ memcpy(new_elems, (vec)->elems, \
+ (vec)->current * sizeof(*new_elems)); \
+ ast_free((vec)->elems); \
(vec)->elems = new_elems; \
(vec)->max = new_max; \
} else { \
More information about the asterisk-commits
mailing list