aboutsummaryrefslogtreecommitdiff
path: root/buffered_file.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2012-07-24 14:14:32 +0200
committerJuan Quintela <quintela@redhat.com>2012-10-17 18:34:57 +0200
commit05e72dc5812a9f461fc2c606dff2572909eafc39 (patch)
tree0ba87be7305854ce072e9818b2e0eb93d4a82ff5 /buffered_file.c
parent6f4d6b09088ee161ff4be0e4db4e4c0962c79070 (diff)
downloadqemu-05e72dc5812a9f461fc2c606dff2572909eafc39.zip
qemu-05e72dc5812a9f461fc2c606dff2572909eafc39.tar.gz
qemu-05e72dc5812a9f461fc2c606dff2572909eafc39.tar.bz2
buffered_file: g_realloc() can't fail
Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Orit Wasserman <owasserm@redhat.com>
Diffstat (limited to 'buffered_file.c')
-rw-r--r--buffered_file.c10
1 files changed, 1 insertions, 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);