From: Diego Nieto Cid <[email protected]>

    ../../console/console.c: In function 'vcons_lookup':
    ../../console/console.c:238:3: warning: ignoring return value of 'asprintf' 
declared with attribute 'warn_unused_result' [-Wunused-result]
---
 console/console.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/console/console.c b/console/console.c
index 443f3f77..e7d7ed58 100644
--- a/console/console.c
+++ b/console/console.c
@@ -235,7 +235,13 @@ vcons_lookup (cons_t cons, int id, int create, vcons_t 
*r_vcons)
   vcons->cons = cons;
   vcons->refcnt = 1;
   vcons->id = id;
-  asprintf (&vcons->name, "%i", id);
+  err = asprintf (&vcons->name, "%i", id);
+  if (err == -1)
+    {
+      free (vcons);
+      pthread_mutex_unlock (&cons->lock);
+      return ENOMEM;
+    }
   /* XXX Error checking.  */
 
   pthread_mutex_init (&vcons->lock, NULL);
-- 
2.51.0


Reply via email to