After reviewing the implementation of av_freep(void* arg) in the FFmpeg documentation, I have some questions. Specifically, can its code be simplified to the following form?
FFmpeg Implementation:
void av_freep(void* arg)
{
void* val;
memcpy(&val, arg, sizeof(val));
memcpy(arg, &(void*){ NULL }, sizeof(val));
av_free(val);
}
my version:
void av_freep(void* arg)
{
free(*arg);
*arg = NULL;
}
New contributor
leafe is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2