Fix incorrect usage of av_realloc (undefined behaviour), use posix_memalign and memcpy instead.
Merge branch 'master' into glinject-next