Passing a non-malloc pointer to free() would be UB. In this case, the free() line is never actually reached (and GCC 17 fails to prove this) in a correct implementation of secp256k1_scratch_space_destroy(), but the test shouldn't rely on the correctness of the tested function.
Alternative to #1880. I think this is cleaner
- it doesn't recreate the scratch space in the middle of some other tests
- it has an obvious matching (malloc, free) pair
- it additionally checks that only
magicis accessed