[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 05/10] util/path: check return value of mallo
From: |
Gonglei (Arei) |
Subject: |
Re: [Qemu-devel] [PATCH v3 05/10] util/path: check return value of malloc() |
Date: |
Thu, 7 Aug 2014 11:04:06 +0000 |
> Subject: [Qemu-devel] [PATCH v3 05/10] util/path: check return value of
> malloc()
>
> Signed-off-by: zhanghailiang <address@hidden>
> ---
Reviewed-by: Gonglei <address@hidden>
Best regards,
-Gonglei
> util/path.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/util/path.c b/util/path.c
> index 5c59d9f..df1653f 100644
> --- a/util/path.c
> +++ b/util/path.c
> @@ -46,9 +46,12 @@ static struct pathelem *new_entry(const char *root,
> const char *name)
> {
> struct pathelem *new = malloc(sizeof(*new));
> - new->name = strdup(name);
> - new->pathname = g_strdup_printf("%s/%s", root, name);
> - new->num_entries = 0;
> +
> + if (new) {
> + new->name = strdup(name);
> + new->pathname = g_strdup_printf("%s/%s", root, name);
> + new->num_entries = 0;
> + }
> return new;
> }
>
> --
> 1.7.12.4
>
>
- [Qemu-devel] [PATCH v3 00/10] fix three bugs about use-after-free and several api abuse, zhanghailiang, 2014/08/07
- [Qemu-devel] [PATCH v3 02/10] monitor: fix access freed memory, zhanghailiang, 2014/08/07
- [Qemu-devel] [PATCH v3 03/10] virtio-blk: fix reference a pointer which might be freed, zhanghailiang, 2014/08/07
- [Qemu-devel] [PATCH v3 10/10] block/vvfat: fix setbuf stream parameter may be NULL, zhanghailiang, 2014/08/07
- [Qemu-devel] [PATCH v3 01/10] l2cap: fix access freed memory, zhanghailiang, 2014/08/07
- [Qemu-devel] [PATCH v3 05/10] util/path: check return value of malloc(), zhanghailiang, 2014/08/07
- Re: [Qemu-devel] [PATCH v3 05/10] util/path: check return value of malloc(),
Gonglei (Arei) <=
- [Qemu-devel] [PATCH v3 09/10] tcg: check return value of fopen(), zhanghailiang, 2014/08/07
- [Qemu-devel] [PATCH v3 06/10] slirp: check return value of malloc(), zhanghailiang, 2014/08/07
- [Qemu-devel] [PATCH v3 07/10] linux-user: check return value of malloc(), zhanghailiang, 2014/08/07
- [Qemu-devel] [PATCH v3 08/10] qtest: check the value returned by fopen(), zhanghailiang, 2014/08/07