Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions plugins/out_azure_blob/azure_blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,14 @@ static int send_blob(struct flb_config *config,

if (blob_type == AZURE_BLOB_APPENDBLOB) {
uri = azb_append_blob_uri(ctx, tag);

block_id = flb_sds_create_len("\0", 1);

if (block_id == NULL) {
cfl_sds_destroy(ref_name);

return FLB_RETRY;
}
}
else if (blob_type == AZURE_BLOB_BLOCKBLOB) {
if (event_type == FLB_EVENT_TYPE_LOGS) {
Expand All @@ -388,8 +396,12 @@ static int send_blob(struct flb_config *config,
}

if (!uri) {
flb_free(block_id);
if (block_id != NULL) {
flb_free(block_id);
}

flb_sds_destroy(ref_name);

return FLB_RETRY;
}

Expand All @@ -403,7 +415,11 @@ static int send_blob(struct flb_config *config,
&payload_buf, &payload_size);
if (ret != 0) {
flb_sds_destroy(uri);
flb_free(block_id);

if (block_id != NULL) {
flb_free(block_id);
}

flb_sds_destroy(ref_name);
return FLB_ERROR;
}
Expand All @@ -420,7 +436,6 @@ static int send_blob(struct flb_config *config,
/* For Logs type, we need to commit the block right away */
if (event_type == FLB_EVENT_TYPE_LOGS) {
ret = azb_block_blob_commit_block(ctx, block_id, tag, ms);
flb_free(block_id);
}
}
else if (ret == CREATE_BLOB) {
Expand All @@ -436,7 +451,10 @@ static int send_blob(struct flb_config *config,
}

flb_sds_destroy(uri);
flb_free(block_id);

if (block_id != NULL) {
flb_free(block_id);
}

return ret;
}
Expand Down Expand Up @@ -593,13 +611,13 @@ static int ensure_container(struct flb_azure_blob *ctx)
else if (status == 200) {
flb_plg_info(ctx->ins, "container '%s' already exists", ctx->container_name);
return FLB_TRUE;
}
}
else if (status == 403) {
flb_plg_error(ctx->ins, "failed getting container '%s', access denied",
ctx->container_name);
return FLB_FALSE;
}

flb_plg_error(ctx->ins, "get container request failed, status=%i",
status);

Expand Down
Loading