@@ -759,7 +759,7 @@ static int cb_calyptia_init(struct flb_output_instance *ins,
759759
760760#ifdef FLB_HAVE_CHUNK_TRACE
761761 ctx -> trace_endpoint = flb_sds_create_size (256 );
762- flb_sds_printf (& ctx -> trace_endpoint , CALYPTIA_ENDPOINT_TRACE ,
762+ flb_sds_printf (& ctx -> trace_endpoint , CALYPTIA_ENDPOINT_TRACE ,
763763 ctx -> pipeline_id );
764764#endif /* FLB_HAVE_CHUNK_TRACE */
765765 return 0 ;
@@ -790,7 +790,7 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk,
790790 void * out_context ,
791791 struct flb_config * config )
792792{
793- int ret ;
793+ int ret = FLB_RETRY ;
794794 size_t off = 0 ;
795795 size_t out_size = 0 ;
796796 char * out_buf = NULL ;
@@ -801,7 +801,7 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk,
801801#endif /* FLB_HAVE_CHUNK_TRACE */
802802
803803 struct flb_connection * u_conn ;
804- struct flb_http_client * c ;
804+ struct flb_http_client * c = NULL ;
805805 struct flb_calyptia * ctx = out_context ;
806806 struct cmt * cmt ;
807807 (void ) i_ins ;
@@ -867,7 +867,7 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk,
867867 cmt_encode_msgpack_destroy (out_buf );
868868 }
869869 }
870-
870+
871871#ifdef FLB_HAVE_CHUNK_TRACE
872872 if (event_chunk -> type == (FLB_EVENT_TYPE_LOGS | FLB_EVENT_TYPE_HAS_TRACE )) {
873873 json = flb_pack_msgpack_to_json_format (event_chunk -> data ,
@@ -896,7 +896,7 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk,
896896 flb_sds_destroy (ctx -> metrics_endpoint );
897897 FLB_OUTPUT_RETURN (FLB_RETRY );
898898 }
899-
899+
900900 /* perform request: 'ret' might be FLB_OK, FLB_ERROR or FLB_RETRY */
901901 ret = calyptia_http_do (ctx , c , CALYPTIA_ACTION_TRACE );
902902 if (ret == FLB_OK ) {
@@ -911,7 +911,10 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk,
911911#endif /* FLB_HAVE_CHUNK_TRACE */
912912
913913 flb_upstream_conn_release (u_conn );
914- flb_http_client_destroy (c );
914+
915+ if (c ) {
916+ flb_http_client_destroy (c );
917+ }
915918 FLB_OUTPUT_RETURN (ret );
916919}
917920
0 commit comments