File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ memory_usage regression in 0.15.0
3+ --FILE--
4+ <?php
5+ $ start = memory_get_usage ();
6+ zstd_uncompress (zstd_compress (str_repeat ('a ' , 1000 )));
7+ $ end = memory_get_usage ();
8+ echo ($ end - $ start ) . "\n" ;
9+ ?>
10+ --EXPECT--
11+ 0
Original file line number Diff line number Diff line change @@ -527,7 +527,7 @@ ZEND_FUNCTION(zstd_uncompress)
527527 ctx .input .size = ZSTR_LEN (input );
528528 ctx .input .pos = 0 ;
529529
530- ctx .output .dst = emalloc ( size );
530+ ctx .output .dst = erealloc ( ctx . output . dst , size );
531531 ctx .output .size = size ;
532532 ctx .output .pos = 0 ;
533533
@@ -646,7 +646,7 @@ ZEND_FUNCTION(zstd_uncompress_dict)
646646 ctx .input .size = ZSTR_LEN (input );
647647 ctx .input .pos = 0 ;
648648
649- ctx .output .dst = emalloc ( size );
649+ ctx .output .dst = erealloc ( ctx . output . dst , size );
650650 ctx .output .size = size ;
651651 ctx .output .pos = 0 ;
652652
You can’t perform that action at this time.
0 commit comments