char * psz_message;
} msg_context_t;
+static void cleanup_msg_context (void *data)
+{
+ msg_context_t *ctx = data;
+ free (ctx->psz_message);
+ free (ctx);
+}
+
static vlc_threadvar_t msg_context;
static uintptr_t banks = 0;
vlc_mutex_lock( &msg_stack_lock );
if( banks++ == 0 )
- vlc_threadvar_create( &msg_context, NULL );
+ vlc_threadvar_create( &msg_context, cleanup_msg_context );
vlc_mutex_unlock( &msg_stack_lock );
}
p_obj = p_obj->p_parent;
}
- msg_bank_t *p_queue = &QUEUE;
- vlc_mutex_lock( &p_queue->lock );
-
/* Fill message information fields */
p_item->i_type = i_type;
p_item->i_object_id = (uintptr_t)p_this;
p_item->psz_header = psz_header;
PrintMsg( p_this, p_item );
+
+ msg_bank_t *p_queue = &QUEUE;
+ vlc_mutex_lock( &p_queue->lock );
#define bank p_queue
for (int i = 0; i < bank->i_sub; i++)
{
return;
}
- int canc = vlc_savecancel ();
#ifdef UNDER_CE
# define CE_WRITE(str) WriteFile( QUEUE.logfile, \
str, strlen(str), &i_dummy, NULL );
FlushFileBuffers( QUEUE.logfile );
#else
+ int canc = vlc_savecancel ();
/* Send the message to stderr */
utf8_fprintf( stderr, "[%s%p%s] %s%s%s %s%s: %s%s%s\n",
priv->b_color ? GREEN : "",
msg_context_t *p_ctx = vlc_threadvar_get( &msg_context );
if( p_ctx == NULL )
{
- MALLOC_NULL( p_ctx, msg_context_t );
+ p_ctx = malloc( sizeof( msg_context_t ) );
+ if( !p_ctx )
+ return NULL;
p_ctx->psz_message = NULL;
vlc_threadvar_set( &msg_context, p_ctx );
}