@@ -366,6 +366,14 @@ static int send_blob(struct flb_config *config,
366
366
367
367
if (blob_type == AZURE_BLOB_APPENDBLOB ) {
368
368
uri = azb_append_blob_uri (ctx , tag );
369
+
370
+ block_id = flb_sds_create_len ("\0" , 1 );
371
+
372
+ if (block_id == NULL ) {
373
+ cfl_sds_destroy (ref_name );
374
+
375
+ return FLB_RETRY ;
376
+ }
369
377
}
370
378
else if (blob_type == AZURE_BLOB_BLOCKBLOB ) {
371
379
if (event_type == FLB_EVENT_TYPE_LOGS ) {
@@ -388,8 +396,12 @@ static int send_blob(struct flb_config *config,
388
396
}
389
397
390
398
if (!uri ) {
391
- flb_free (block_id );
399
+ if (block_id != NULL ) {
400
+ flb_free (block_id );
401
+ }
402
+
392
403
flb_sds_destroy (ref_name );
404
+
393
405
return FLB_RETRY ;
394
406
}
395
407
@@ -403,7 +415,11 @@ static int send_blob(struct flb_config *config,
403
415
& payload_buf , & payload_size );
404
416
if (ret != 0 ) {
405
417
flb_sds_destroy (uri );
406
- flb_free (block_id );
418
+
419
+ if (block_id != NULL ) {
420
+ flb_free (block_id );
421
+ }
422
+
407
423
flb_sds_destroy (ref_name );
408
424
return FLB_ERROR ;
409
425
}
@@ -420,7 +436,6 @@ static int send_blob(struct flb_config *config,
420
436
/* For Logs type, we need to commit the block right away */
421
437
if (event_type == FLB_EVENT_TYPE_LOGS ) {
422
438
ret = azb_block_blob_commit_block (ctx , block_id , tag , ms );
423
- flb_free (block_id );
424
439
}
425
440
}
426
441
else if (ret == CREATE_BLOB ) {
@@ -436,7 +451,10 @@ static int send_blob(struct flb_config *config,
436
451
}
437
452
438
453
flb_sds_destroy (uri );
439
- flb_free (block_id );
454
+
455
+ if (block_id != NULL ) {
456
+ flb_free (block_id );
457
+ }
440
458
441
459
return ret ;
442
460
}
@@ -593,13 +611,13 @@ static int ensure_container(struct flb_azure_blob *ctx)
593
611
else if (status == 200 ) {
594
612
flb_plg_info (ctx -> ins , "container '%s' already exists" , ctx -> container_name );
595
613
return FLB_TRUE ;
596
- }
614
+ }
597
615
else if (status == 403 ) {
598
616
flb_plg_error (ctx -> ins , "failed getting container '%s', access denied" ,
599
617
ctx -> container_name );
600
618
return FLB_FALSE ;
601
619
}
602
-
620
+
603
621
flb_plg_error (ctx -> ins , "get container request failed, status=%i" ,
604
622
status );
605
623
0 commit comments