[DTrace-devel] [PATCH v2 2/8] btf: always load BTF (if available)

Eugene Loh eugene.loh at oracle.com
Sat Apr 13 01:50:44 UTC 2024


I spent some time looking at this and it looks fine, but maybe Nick 
should have a look.  It does now compile on OL7.  And one tiny nit below:

On 4/12/24 10:57, Kris Van Hees via DTrace-devel wrote:
> diff --git a/libdtrace/dt_btf.c b/libdtrace/dt_btf.c
> @@ -315,14 +303,14 @@ elf_fail:
>   elf_fail_no_end:
>   	err = elf_errno();
>   	dt_btf_error(dtp, 0, "BTF: %s", elf_errmsg(err));
> -	fclose(fp);
> -
> -	return NULL;
>   
>   fail:
> +	fclose(fp);

In these exit actions, we usually do stuff in the reverse order from how 
they're set up.  So I think the fclose() should go after the free(data), 
not before.  Not a big deal.

>   	dt_free(dtp, data);
> +
> +err:
> +	dt_free(dtp, btf);
>   	dt_btf_set_errno(dtp,  err ? err : errno);
> -	fclose(fp);
>   
>   	return NULL;
>   }



More information about the DTrace-devel mailing list