svnno****@sourc*****
svnno****@sourc*****
2011年 4月 8日 (金) 11:26:13 JST
Revision: 553 http://sourceforge.jp/projects/swfed/svn/view?view=rev&revision=553 Author: yoya Date: 2011-04-08 11:26:13 +0900 (Fri, 08 Apr 2011) Log Message: ----------- bitstream_steal で realloc の使い方を間違えていたので修正 (サイズが小さい方向への realloc なので滅多にないはずだが) realloc でメモリの場所が移動した場合に対応出来ない Modified Paths: -------------- trunk/src/bitstream.c trunk/src/swf_debug.c -------------- next part -------------- Modified: trunk/src/bitstream.c =================================================================== --- trunk/src/bitstream.c 2011-04-07 18:59:33 UTC (rev 552) +++ trunk/src/bitstream.c 2011-04-08 02:26:13 UTC (rev 553) @@ -84,11 +84,12 @@ *length = bs->data_len; if ((tmp = realloc(data, *length)) == NULL) { fprintf(stderr, "bitstream_steal: Can't realloc\n"); + return NULL; } bs->data = NULL; bs->data_len = 0; bs->data_alloc_len = 0; - return data; + return tmp; } unsigned char * Modified: trunk/src/swf_debug.c =================================================================== --- trunk/src/swf_debug.c 2011-04-07 18:59:33 UTC (rev 552) +++ trunk/src/swf_debug.c 2011-04-08 02:26:13 UTC (rev 553) @@ -112,6 +112,9 @@ int i; void *new_ptr; new_ptr = realloc(ptr, size); + if (new_ptr == ptr) { + return new_ptr; + } // fprintf(stderr, "realloc_debug: ptr=%p => new_ptr=%p (%s,%d)\n", // ptr, new_ptr, filename, linenum); for (i=0 ; i < MALLOC_DEBUG_TABLE_NUM ; i++) {