[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 01/41] buffered_file: g_realloc() can't fail
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH 01/41] buffered_file: g_realloc() can't fail |
Date: |
Fri, 21 Sep 2012 14:11:13 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 |
Il 21/09/2012 10:46, Juan Quintela ha scritto:
> Signed-off-by: Juan Quintela <address@hidden>
> ---
> buffered_file.c | 10 +---------
> 1 file changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/buffered_file.c b/buffered_file.c
> index f170aa0..4148abb 100644
> --- a/buffered_file.c
> +++ b/buffered_file.c
> @@ -50,20 +50,12 @@ static void buffered_append(QEMUFileBuffered *s,
> const uint8_t *buf, size_t size)
> {
> if (size > (s->buffer_capacity - s->buffer_size)) {
> - void *tmp;
> -
> DPRINTF("increasing buffer capacity from %zu by %zu\n",
> s->buffer_capacity, size + 1024);
>
> s->buffer_capacity += size + 1024;
>
> - tmp = g_realloc(s->buffer, s->buffer_capacity);
> - if (tmp == NULL) {
> - fprintf(stderr, "qemu file buffer expansion failed\n");
> - exit(1);
> - }
> -
> - s->buffer = tmp;
> + s->buffer = g_realloc(s->buffer, s->buffer_capacity);
> }
>
> memcpy(s->buffer + s->buffer_size, buf, size);
>
Reviewed-by: Paolo Bonzini <address@hidden>
Paolo
- [Qemu-devel] [PATCH 00/41] Migration cleanups, refactorings, stats, and more, Juan Quintela, 2012/09/21
- [Qemu-devel] [PATCH 02/41] fix migration sync, Juan Quintela, 2012/09/21
- [Qemu-devel] [PATCH 01/41] buffered_file: g_realloc() can't fail, Juan Quintela, 2012/09/21
- [Qemu-devel] [PATCH 05/41] migration: rename expected_time to expected_downtime, Juan Quintela, 2012/09/21
- [Qemu-devel] [PATCH 03/41] migration: store end_time in a local variable, Juan Quintela, 2012/09/21
- [Qemu-devel] [PATCH 04/41] migration: print total downtime for final phase of migration, Juan Quintela, 2012/09/21