@@ -1509,16 +1509,12 @@ out:
static int bpf_make_custom_path(const struct bpf_elf_ctx *ctx,
const char *todo)
{
- char *tmp = NULL;
+ char tmp[PATH_MAX];
char *rem = NULL;
char *sub;
int ret;
- ret = asprintf(&tmp, "%s/../", bpf_get_work_dir(ctx->type));
- if (ret < 0) {
- fprintf(stderr, "asprintf failed: %s\n", strerror(errno));
- goto out;
- }
+ snprintf(tmp, PATH_MAX, "%s/../", bpf_get_work_dir(ctx->type));
ret = asprintf(&rem, "%s/", todo);
if (ret < 0) {
@@ -1547,7 +1543,6 @@ static int bpf_make_custom_path(const struct bpf_elf_ctx *ctx,
ret = 0;
out:
free(rem);
- free(tmp);
return ret;
}