@@ -475,13 +475,19 @@ int isal_deflate_dict_perf(uint8_t * outbuf, uint64_t * outbuf_size, uint8_t * i
475
475
}
476
476
477
477
stream .level = level ;
478
- isal_deflate_process_dict (& stream , & dict_str , dict_buf , dict_file_size );
478
+ if (isal_deflate_process_dict (& stream , & dict_str , dict_buf , dict_file_size ) != COMP_OK ) {
479
+ if (level_buf != NULL )
480
+ free (level_buf );
481
+ return 1 ;
482
+ }
479
483
480
484
BENCHMARK (start , time , check =
481
485
isal_deflate_dict_round (& stream , outbuf , * outbuf_size , inbuf ,
482
486
inbuf_size , level , level_buf ,
483
487
level_size_buf [level ], flush_type , hist_bits ,
484
488
& dict_str ));
489
+ if (level_buf != NULL )
490
+ free (level_buf );
485
491
* outbuf_size = stream .total_out ;
486
492
return check ;
487
493
}
@@ -879,8 +885,13 @@ int main(int argc, char *argv[])
879
885
printf ("\n" );
880
886
881
887
if (outfile != NULL && i + 1 == compression_queue_size ) {
882
- FILE * out ;
883
- out = fopen (outfile , "wb" );
888
+ FILE * out = fopen (outfile , "wb" );
889
+
890
+ if (out == NULL ) {
891
+ fprintf (stderr , "Could not write to the output file \"%s\"\n" ,
892
+ outfile );
893
+ exit (0 );
894
+ }
884
895
fwrite (compressbuf , 1 , info .deflate_size , out );
885
896
fclose (out );
886
897
}
0 commit comments