qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] do not pass NULL to strdup.


From: Gleb Natapov
Subject: [Qemu-devel] [PATCH] do not pass NULL to strdup.
Date: Wed, 2 Feb 2011 17:34:34 +0200

Also use qemu_strdup() instead of strdup() in bootindex code.

Signed-off-by: Gleb Natapov <address@hidden>
---

Should go to stable too.

diff --git a/vl.c b/vl.c
index 655617f..ed2cdfa 100644
--- a/vl.c
+++ b/vl.c
@@ -738,7 +738,7 @@ void add_boot_device_path(int32_t bootindex, DeviceState 
*dev,
 
     node = qemu_mallocz(sizeof(FWBootEntry));
     node->bootindex = bootindex;
-    node->suffix = strdup(suffix);
+    node->suffix = suffix ? qemu_strdup(suffix) : NULL;
     node->dev = dev;
 
     QTAILQ_FOREACH(i, &fw_boot_order, link) {
@@ -785,7 +785,7 @@ char *get_boot_devices_list(uint32_t *size)
         } else if (devpath) {
             bootpath = devpath;
         } else {
-            bootpath = strdup(i->suffix);
+            bootpath = qemu_strdup(i->suffix);
             assert(bootpath);
         }
 
--
                        Gleb.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]