$OpenBSD: patch-src_xine-engine_xine_c,v 1.13 2011/05/11 09:05:55 dcoppa Exp $

- Proper place for log mutex initialization. Fixed a leak.
- Various small memory leaks in xine engine.

--- src/xine-engine/xine.c.orig	Thu Apr 29 12:55:02 2010
+++ src/xine-engine/xine.c	Mon May  9 20:39:54 2011
@@ -654,6 +654,7 @@ xine_stream_t *xine_stream_new (xine_t *this,
   pthread_mutexattr_init(&attr);
   pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
   pthread_mutex_init (&stream->frontend_lock, &attr);
+  pthread_mutexattr_destroy(&attr);
 
   /*
    * Clear meta/stream info
@@ -1488,6 +1489,8 @@ static void xine_dispose_internal (xine_stream_t *stre
 
   stream->metronom->exit (stream->metronom);
 
+  xine_list_delete(stream->event_queues);
+
   pthread_mutex_lock(&stream->xine->streams_lock);
   ite = xine_list_find(stream->xine->streams, stream);
   if (ite) {
@@ -1561,6 +1564,8 @@ void xine_exit (xine_t *this) {
   if(this->port_ticket)
     this->port_ticket->dispose(this->port_ticket);
 
+  pthread_mutex_destroy(&this->log_lock);
+
 #if defined(WIN32)
   WSACleanup();
 #endif
@@ -1604,6 +1609,7 @@ xine_t *xine_new (void) {
    * log buffers
    */
   memset(this->log_buffers, 0, sizeof(this->log_buffers));
+  pthread_mutex_init (&this->log_lock, NULL);
 
 
 #ifdef WIN32
@@ -1696,7 +1702,6 @@ void xine_init (xine_t *this) {
    * locks
    */
   pthread_mutex_init (&this->streams_lock, NULL);
-  pthread_mutex_init (&this->log_lock, NULL);
 
   /* initialize color conversion tables and functions */
   init_yuv_conversion();
