Skip to content

Commit 6109162

Browse files
pwhelanedsiper
authored andcommitted
in_calyptia_fleet: fix memory leak in get_fleet_id_from_header, found by @alecholmes.
Signed-off-by: Phillip Whelan <[email protected]>
1 parent 067c064 commit 6109162

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

plugins/in_calyptia_fleet/in_calyptia_fleet.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1617,10 +1617,17 @@ static flb_sds_t get_fleet_id_from_header(struct flb_in_calyptia_fleet_config *c
16171617
flb_sds_t fleet_id;
16181618
flb_sds_t name;
16191619
struct flb_cf *cf_hdr;
1620+
flb_sds_t cfgheadername;
16201621

16211622

16221623
if (exists_header_fleet_config(ctx)) {
1623-
cf_hdr = flb_cf_create_from_file(NULL, hdr_fleet_config_filename(ctx));
1624+
cfgheadername = hdr_fleet_config_filename(ctx);
1625+
if (cfgheadername == NULL) {
1626+
return NULL;
1627+
}
1628+
1629+
cf_hdr = flb_cf_create_from_file(NULL, cfgheadername);
1630+
flb_sds_destroy(cfgheadername);
16241631

16251632
if (cf_hdr == NULL) {
16261633
return NULL;

0 commit comments

Comments
 (0)