]> git.tuebingen.mpg.de Git - paraslash.git/commit
audiod: Avoid segfault on exit.
authorAndre Noll <maan@systemlinux.org>
Fri, 4 Apr 2014 12:23:44 +0000 (14:23 +0200)
committerAndre Noll <maan@systemlinux.org>
Fri, 4 Apr 2014 12:37:41 +0000 (14:37 +0200)
commitf299d434d44ea21e598396d163b2b1be5ba8d4a0
tree521746fa10f02b5327d910dc0b4b04bda7c3cca1
parent42ddd68159d7eff0f3e7c225665c97f9abd59425
audiod: Avoid segfault on exit.

When para_audiod terminates, it calls clean_exit() which closes
all slots unconditionally, regardless of whether they are in use.
This may lead to a segfault due to an invalid read:

==25253== Invalid read of size 4
==25253==    at 0x40EBEA: close_slot (audiod.c:443)
==25253==    by 0x40FCE8: clean_exit (audiod.c:1163)
==25253==    by 0x40FD7D: signal_post_select (audiod.c:1014)
==25253==    by 0x41490A: schedule (sched.c:65)
==25253==    by 0x406BC3: main (audiod.c:1436)
==25253==  Address 0x5c19d8 is not stack'd, malloc'd or (recently) free'd

This bug was introduced 9 month ago in commit eec23a69 (audiod:
Fix memory leak on exit: close slots). Fix it by calling
close_unused_slots(). This also simplifies clean_exit() a bit.
audiod.c