[vlc-devel] [RFC 35/38] gui/ncurses: replaced usage of xmalloc

Filip Roséen filip at videolabs.io
Mon Jun 27 13:43:46 CEST 2016


This patch effectivelly says that if we cannot allocate a copy for the
vlc_log_t passed, we will simply ignore it; issuing an error-diagnostic
on this type of error is paradoxal.
---
 modules/gui/ncurses.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/modules/gui/ncurses.c b/modules/gui/ncurses.c
index 73bfbbd..e154fc4 100644
--- a/modules/gui/ncurses.c
+++ b/modules/gui/ncurses.c
@@ -1742,7 +1742,11 @@ static void HandleKey(intf_thread_t *intf, input_thread_t *input)
  */
 static vlc_log_t *msg_Copy (const vlc_log_t *msg)
 {
-    vlc_log_t *copy = (vlc_log_t *)xmalloc (sizeof (*copy));
+    vlc_log_t *copy = (vlc_log_t *)malloc (sizeof (*copy));
+
+    if( unlikely( !copy ) )
+        return NULL;
+
     copy->i_object_id = msg->i_object_id;
     copy->psz_object_type = msg->psz_object_type;
     copy->psz_module = strdup (msg->psz_module);
-- 
2.9.0



More information about the vlc-devel mailing list