[vlc-commits] messages: don't output a NULL string

Steve Lhomme git at videolan.org
Wed Apr 3 09:56:01 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Apr  3 09:23:33 2019 +0200| [4748c717e5622e202b4c58b0f11dda01e2ca5de9] | committer: Steve Lhomme

messages: don't output a NULL string

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4748c717e5622e202b4c58b0f11dda01e2ca5de9
---

 src/misc/messages.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/misc/messages.c b/src/misc/messages.c
index 41f0d23a09..c100a56865 100644
--- a/src/misc/messages.c
+++ b/src/misc/messages.c
@@ -174,8 +174,11 @@ static void Win32DebugOutputMsg (void* d, int type, const vlc_log_t *p_item,
         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);
+            if (likely(wmsg != NULL))
+            {
+                OutputDebugStringW(wmsg);
+                free(wmsg);
+            }
             free(psz_msg);
         }
     }



More information about the vlc-commits mailing list