On Thu, 27 Jul 2023 16:59:58 GMT, Brian Burkhalter <[email protected]> wrote:
>> Then I guess we don't need this `if`-clause
>
> Then I think one gets an error if `0 < len < BUF_SIZE`:
>
>
> $ cat free.c
> #include <stdlib.h>
>
> int main(int argc, char** argv)
> {
> char stackBuf[8];
> char* buf;
>
> buf = stackBuf;
> free(buf);
> }
> bpb:test{175}$ ./free
> free(14365,0x10e6a1600) malloc: *** error for object 0x7ff7b7d38280: pointer
> being freed was not allocated
> free(14365,0x10e6a1600) malloc: *** set a breakpoint in malloc_error_break to
> debug
> Abort trap: 6
>
> This is on macOS.
Right!
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14981#discussion_r1276747895