Skip to content

Commit

Permalink
in_calyptia_fleet: fix possible uninit usage
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Stephens <[email protected]>
  • Loading branch information
patrick-stephens committed Dec 16, 2024
1 parent 5c80ce7 commit e302b5b
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions plugins/in_calyptia_fleet/in_calyptia_fleet.c
Original file line number Diff line number Diff line change
Expand Up @@ -525,11 +525,9 @@ static int parse_config_name_timestamp(struct flb_in_calyptia_fleet_config *ctx,
return FLB_FALSE;
}

/* Prevent undefined references due to use of readlink */
#ifdef FLB_SYSTEM_WINDOWS
strncpy(realname, cfgpath, sizeof(realname)-1);
#else
switch (is_link(cfgpath)) {
/* Prevent undefined references due to use of readlink */
#ifndef FLB_SYSTEM_WINDOWS
case FLB_TRUE:

len = readlink(cfgpath, realname, sizeof(realname));
Expand All @@ -538,14 +536,14 @@ static int parse_config_name_timestamp(struct flb_in_calyptia_fleet_config *ctx,
return FLB_FALSE;
}
break;
#endif /* FLB_SYSTEM_WINDOWS */
case FLB_FALSE:
strncpy(realname, cfgpath, sizeof(realname)-1);
break;
default:
flb_errno();
return FLB_FALSE;
}
#endif

fname = basename(realname);
flb_plg_debug(ctx->ins, "parsing configuration timestamp from path: %s", fname);
Expand Down Expand Up @@ -1620,7 +1618,6 @@ static flb_sds_t get_fleet_id_from_header(struct flb_in_calyptia_fleet_config *c
cf_hdr = flb_cf_create_from_file(NULL, hdr_fleet_config_filename(ctx));

if (cf_hdr == NULL) {
flb_cf_destroy(cf_hdr);
return NULL;
}

Expand Down Expand Up @@ -1656,9 +1653,10 @@ static flb_sds_t get_fleet_id_from_header(struct flb_in_calyptia_fleet_config *c
flb_cf_destroy(cf_hdr);
return fleet_id;
}

flb_cf_destroy(cf_hdr);
}

flb_cf_destroy(cf_hdr);
return NULL;
}

Expand Down

0 comments on commit e302b5b

Please sign in to comment.