Index: samples/shell.cc |
diff --git a/samples/shell.cc b/samples/shell.cc |
index 0a9b8a0d4f899ba423af2eafd4135341dada952f..d6475034f97481805b0ba8535e5ee2330a0c1d04 100644 |
--- a/samples/shell.cc |
+++ b/samples/shell.cc |
@@ -309,17 +309,19 @@ int main(int argc, char* argv[]) { |
v8::StartupData* compressed_data = new v8::StartupData[compressed_data_count]; |
v8::V8::GetCompressedStartupData(compressed_data); |
for (int i = 0; i < compressed_data_count; ++i) { |
- char* decompressed = new char[compressed_data[i].raw_size]; |
unsigned int decompressed_size = compressed_data[i].raw_size; |
- int result = |
- BZ2_bzBuffToBuffDecompress(decompressed, |
- &decompressed_size, |
- const_cast<char*>(compressed_data[i].data), |
- compressed_data[i].compressed_size, |
- 0, 1); |
- if (result != BZ_OK) { |
- fprintf(stderr, "bzip error code: %d\n", result); |
- exit(1); |
+ char* decompressed = new char[decompressed_size]; |
+ if (compressed_data[i].compressed_size != 0) { |
Vitaly Repeshko
2011/06/06 10:08:23
When does this happen?
mnaganov (inactive)
2011/06/06 13:40:18
When there is no snapshot. See snapshot-empty.cc.
|
+ int result = |
+ BZ2_bzBuffToBuffDecompress(decompressed, |
+ &decompressed_size, |
+ const_cast<char*>(compressed_data[i].data), |
+ compressed_data[i].compressed_size, |
+ 0, 1); |
+ if (result != BZ_OK) { |
+ fprintf(stderr, "bzip error code: %d\n", result); |
+ exit(1); |
+ } |
} |
compressed_data[i].data = decompressed; |
Vitaly Repeshko
2011/06/06 10:08:23
It seems strange that we assign a block of fresh u
mnaganov (inactive)
2011/06/06 13:40:18
We should never read from it in this case. I've ad
|
compressed_data[i].raw_size = decompressed_size; |