[vlc-devel] [PATCH] src: Win32: add message categories to debug logs

Rafaël Carré funman at videolan.org
Sun Feb 3 15:47:09 CET 2013


Le 03/02/2013 15:46, Rafaël Carré a écrit :
> Le 03/02/2013 15:12, Edward Wang a écrit :
>> ---
>>  src/misc/messages.c |   11 ++++++++---
>>  1 files changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/src/misc/messages.c b/src/misc/messages.c
>> index 1d8fd0b..d754b7c 100644
>> --- a/src/misc/messages.c
>> +++ b/src/misc/messages.c
>> @@ -325,9 +325,14 @@ static void Win32DebugOutputMsg (void* d, int type, const msg_item_t *p_item,
>>              msg[msg_len] = '\n';
>>              msg[msg_len + 1] = '\0';
>>          }
>> -        wchar_t *wmsg = ToWide(msg);
>> -        OutputDebugStringW(wmsg);
>> -        free(wmsg);
>> +        char* psz_msg = NULL;
>> +        if(asprintf(&psz_msg, "%s %s%s: %s", p_item->psz_module,
>> +                    p_item->psz_object_type, msg_type[type], msg) > 0) {
>> +            wchar_t* wmsg = ToWide(psz_msg);
>> +            OutputDebugStringW(wmsg);
>> +            free(wmsg);
>> +            free(psz_msg);
>> +        }
> 
> Nitpick: wmsg is leaked if asprintf fails

Once again I read too fast ... sorry.

Looks good to me.

>>      }
>>      free(msg);
>>  }
>>
> 




More information about the vlc-devel mailing list