Patchwork pci: use qemu_malloc() in pcibus_get_dev_path()

login
register
mail settings
Submitter Isaku Yamahata
Date Jan. 20, 2011, 6:57 a.m.
Message ID <14aa6d9be3106715ceb3a04845ad59d435efc898.1295506335.git.yamahata@valinux.co.jp>
Download mbox | patch
Permalink /patch/79639/
State New
Headers show

Comments

Isaku Yamahata - Jan. 20, 2011, 6:57 a.m.
use qemu_malloc() instead of direct use of malloc().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
---
 hw/pci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Michael S. Tsirkin - Jan. 20, 2011, 1:45 p.m.
On Thu, Jan 20, 2011 at 03:57:49PM +0900, Isaku Yamahata wrote:
> use qemu_malloc() instead of direct use of malloc().
> 
> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
> ---
>  hw/pci.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Thanks, applied.

> diff --git a/hw/pci.c b/hw/pci.c
> index 851f350..86af0ee 100644
> --- a/hw/pci.c
> +++ b/hw/pci.c
> @@ -2053,7 +2053,7 @@ static char *pcibus_get_dev_path(DeviceState *dev)
>      path_len = domain_len + slot_len * slot_depth;
>  
>      /* Allocate memory, fill in the terminating null byte. */
> -    path = malloc(path_len + 1 /* For '\0' */);
> +    path = qemu_malloc(path_len + 1 /* For '\0' */);
>      path[path_len] = '\0';
>  
>      /* First field is the domain. */
> -- 
> 1.7.1.1

Patch

diff --git a/hw/pci.c b/hw/pci.c
index 851f350..86af0ee 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -2053,7 +2053,7 @@  static char *pcibus_get_dev_path(DeviceState *dev)
     path_len = domain_len + slot_len * slot_depth;
 
     /* Allocate memory, fill in the terminating null byte. */
-    path = malloc(path_len + 1 /* For '\0' */);
+    path = qemu_malloc(path_len + 1 /* For '\0' */);
     path[path_len] = '\0';
 
     /* First field is the domain. */