[MPlayer-dev-eng] [PATCH] Fix a memory leak in the ASS glyph cache

Nicolas George nicolas.george at normalesup.org
Sat Nov 3 13:46:16 CET 2007


Hi.

The glyph_hash_key_t structure has padding (on arch where long or double are
8-aligned, including x86_64). The glyph cache table compares it with memcmp,
and hashes it in a similar way. Therefore, the padding must be initialized.
Otherwise, the cache lookup will falsely fail, and the memory will be filled
with redundant glyphs.

Note: another way to fix it would be to write proper compare and hash
functions, but that requires much more code, and writing a good hash
function is not easy.

There may be other similar leaks, but this one in particular almost crashed
my box yesterday.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mplayer-asscache-20071103.diff
Type: text/x-diff
Size: 383 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20071103/c5451a8d/attachment.diff>


More information about the MPlayer-dev-eng mailing list