On Mon, Aug 15, 2011 at 03:36:51PM +0800, Maarten Bosmans wrote: > Good catch! > > An alternative solution (and IMHO better one) would be to move the two > lines allocating the mutex and semaphore below the if-block that can > return. That way you avoid the memory-leak situation alltogether. Thanks for the suggestion, I decided to move it a bit lower because lines around the if statement are all about blocks related. ;) Please see the attachment. -- guanqun