@@ -150,6 +150,10 @@ struct flb_http_request *flb_http_request_create()
150
150
151
151
void flb_http_request_destroy (struct flb_http_request * request )
152
152
{
153
+ if (request -> authority != NULL ) {
154
+ cfl_sds_destroy (request -> authority );
155
+ }
156
+
153
157
if (request -> path != NULL ) {
154
158
cfl_sds_destroy (request -> path );
155
159
}
@@ -654,6 +658,12 @@ int flb_http_request_set_url(struct flb_http_request *request,
654
658
int flb_http_request_set_uri (struct flb_http_request * request ,
655
659
char * uri )
656
660
{
661
+ if (request -> path != NULL ) {
662
+ cfl_sds_destroy (request -> path );
663
+
664
+ request -> path = NULL ;
665
+ }
666
+
657
667
request -> path = cfl_sds_create (uri );
658
668
659
669
if (request -> path == NULL ) {
@@ -666,6 +676,12 @@ int flb_http_request_set_uri(struct flb_http_request *request,
666
676
int flb_http_request_set_query_string (struct flb_http_request * request ,
667
677
char * query_string )
668
678
{
679
+ if (request -> query_string != NULL ) {
680
+ cfl_sds_destroy (request -> query_string );
681
+
682
+ request -> query_string = NULL ;
683
+ }
684
+
669
685
request -> query_string = cfl_sds_create (query_string );
670
686
671
687
if (request -> query_string == NULL ) {
@@ -678,6 +694,12 @@ int flb_http_request_set_query_string(struct flb_http_request *request,
678
694
int flb_http_request_set_content_type (struct flb_http_request * request ,
679
695
char * content_type )
680
696
{
697
+ if (request -> content_type != NULL ) {
698
+ cfl_sds_destroy (request -> content_type );
699
+
700
+ request -> content_type = NULL ;
701
+ }
702
+
681
703
request -> content_type = cfl_sds_create (content_type );
682
704
683
705
if (request -> content_type == NULL ) {
@@ -690,6 +712,12 @@ int flb_http_request_set_content_type(struct flb_http_request *request,
690
712
int flb_http_request_set_user_agent (struct flb_http_request * request ,
691
713
char * user_agent )
692
714
{
715
+ if (request -> user_agent != NULL ) {
716
+ cfl_sds_destroy (request -> user_agent );
717
+
718
+ request -> user_agent = NULL ;
719
+ }
720
+
693
721
request -> user_agent = cfl_sds_create (user_agent );
694
722
695
723
if (request -> user_agent == NULL ) {
0 commit comments