diff mbox

do not pass NULL to strdup.

Message ID 20110202153434.GP14984@redhat.com
State New
Headers show

Commit Message

Gleb Natapov Feb. 2, 2011, 3:34 p.m. UTC
Also use qemu_strdup() instead of strdup() in bootindex code.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
---

Should go to stable too.

--
			Gleb.

Comments

Markus Armbruster Feb. 2, 2011, 5:04 p.m. UTC | #1
Gleb Natapov <gleb@redhat.com> writes:

> Also use qemu_strdup() instead of strdup() in bootindex code.
>
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> ---
>
> Should go to stable too.

Yes, please!  By the way, putting 0.14 in the subject should help with
that.
Aurelien Jarno Feb. 4, 2011, 8:23 p.m. UTC | #2
On Wed, Feb 02, 2011 at 05:34:34PM +0200, Gleb Natapov wrote:
> Also use qemu_strdup() instead of strdup() in bootindex code.
> 
> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> ---
> 
> Should go to stable too.

Thanks, applied

> 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.
> 
>
diff mbox

Patch

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);
         }