Yes.
malloc returns void * and free takes void *, so some of your casts are meaningless, and you’re always freeing a void * even if you’re starting with some other sort of pointer.
Yes.
malloc returns void * and free takes void *, so some of your casts are meaningless, and you’re always freeing a void * even if you’re starting with some other sort of pointer.