@@ -640,6 +640,17 @@ struct flb_input_chunk *flb_input_chunk_map(struct flb_input_instance *in,
640
640
return NULL ;
641
641
}
642
642
643
+ ic -> routes_mask = (flb_route_mask_element * )
644
+ flb_calloc (in -> config -> route_mask_size ,
645
+ sizeof (flb_route_mask_element ));
646
+
647
+ if (ic -> routes_mask == NULL ) {
648
+ flb_errno ();
649
+ cio_chunk_close (chunk , CIO_TRUE );
650
+ flb_free (ic );
651
+ return NULL ;
652
+ }
653
+
643
654
if (ic -> event_type == FLB_INPUT_LOGS ) {
644
655
/* Validate records in the chunk */
645
656
ret = flb_mp_validate_log_chunk (buf_data , buf_size , & records , & offset );
@@ -649,6 +660,7 @@ struct flb_input_chunk *flb_input_chunk_map(struct flb_input_instance *in,
649
660
flb_plg_error (in ,
650
661
"chunk validation failed, data might be corrupted. "
651
662
"No valid records found, the chunk will be discarded." );
663
+ flb_free (ic -> routes_mask );
652
664
flb_free (ic );
653
665
return NULL ;
654
666
}
@@ -668,6 +680,7 @@ struct flb_input_chunk *flb_input_chunk_map(struct flb_input_instance *in,
668
680
"Found %d valid records, failed content starts "
669
681
"right after byte %lu. Cannot recover chunk," ,
670
682
records , offset );
683
+ flb_free (ic -> routes_mask );
671
684
flb_free (ic );
672
685
return NULL ;
673
686
}
@@ -680,6 +693,7 @@ struct flb_input_chunk *flb_input_chunk_map(struct flb_input_instance *in,
680
693
flb_plg_error (in ,
681
694
"metrics chunk validation failed, data might be corrupted. "
682
695
"No valid records found, the chunk will be discarded." );
696
+ flb_free (ic -> routes_mask );
683
697
flb_free (ic );
684
698
return NULL ;
685
699
}
@@ -699,6 +713,7 @@ struct flb_input_chunk *flb_input_chunk_map(struct flb_input_instance *in,
699
713
"Found %d valid records, failed content starts "
700
714
"right after byte %lu. Cannot recover chunk," ,
701
715
records , offset );
716
+ flb_free (ic -> routes_mask );
702
717
flb_free (ic );
703
718
return NULL ;
704
719
}
@@ -714,6 +729,7 @@ struct flb_input_chunk *flb_input_chunk_map(struct flb_input_instance *in,
714
729
flb_plg_error (in ,
715
730
"chunk validation failed, data might be corrupted. "
716
731
"No valid records found, the chunk will be discarded." );
732
+ flb_free (ic -> routes_mask );
717
733
flb_free (ic );
718
734
return NULL ;
719
735
}
@@ -724,6 +740,7 @@ struct flb_input_chunk *flb_input_chunk_map(struct flb_input_instance *in,
724
740
*/
725
741
bytes = cio_chunk_get_content_size (chunk );
726
742
if (bytes == -1 ) {
743
+ flb_free (ic -> routes_mask );
727
744
flb_free (ic );
728
745
return NULL ;
729
746
}
@@ -756,13 +773,15 @@ struct flb_input_chunk *flb_input_chunk_map(struct flb_input_instance *in,
756
773
ret = flb_input_chunk_get_tag (ic , & tag_buf , & tag_len );
757
774
if (ret == -1 ) {
758
775
flb_error ("[input chunk] error retrieving tag of input chunk" );
776
+ flb_free (ic -> routes_mask );
759
777
flb_free (ic );
760
778
return NULL ;
761
779
}
762
780
763
781
bytes = flb_input_chunk_get_real_size (ic );
764
782
if (bytes < 0 ) {
765
783
flb_warn ("[input chunk] could not retrieve chunk real size" );
784
+ flb_free (ic -> routes_mask );
766
785
flb_free (ic );
767
786
return NULL ;
768
787
}
0 commit comments