Description:
------------
Hi,
In /ext/fileinfo/libmagic/apprentice.c:
2609 if ((map = CAST(struct magic_map *, ecalloc(1, sizeof(*map)))) == NULL) {
2610 file_oomem(ms, sizeof(*map));
2611 efree(map);
2612 goto error;
2613 }
That goes to error:
2730error:
2731 if (stream) {
2732 php_stream_close(stream);
2733 }
2734 apprentice_unmap(map);
which as you can see, does a double free of 'map'.
The line in the apprentice_unmap function:
499 if (map == NULL)
is kind of useless, because even if it has already been freed, it won't be NULL(unless the php implementation of efree does something different?)
Thanks,