On Wed, Apr 21, 2010 at 6:57 AM, Yoshiaki Tamura
<tamura.yoshi...@lab.ntt.co.jp> wrote:
> @@ -454,6 +458,25 @@ void qemu_fflush(QEMUFile *f)
>     }
>  }
>
> +void *qemu_realloc_buffer(QEMUFile *f, int size)
> +{
> +    f->buf_max_size = size;
> +
> +    f->buf = qemu_realloc(f->buf, f->buf_max_size);
> +    if (f->buf == NULL) {
> +        fprintf(stderr, "qemu file buffer realloc failed\n");
> +        exit(1);
> +    }
> +
> +    return f->buf;
> +}
> +

qemu_realloc() will abort() if there was not enough memory to realloc.
 Just like qemu_malloc(), you don't need to check for NULL.

Stefan


Reply via email to