summaryrefslogtreecommitdiffstats
path: root/ctdb
diff options
context:
space:
mode:
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/libctdb/io_elem.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ctdb/libctdb/io_elem.c b/ctdb/libctdb/io_elem.c
index 1a176988d1..e00ddda056 100644
--- a/ctdb/libctdb/io_elem.c
+++ b/ctdb/libctdb/io_elem.c
@@ -110,11 +110,13 @@ int read_io_elem(int fd, struct io_elem *io)
/* Finished. But maybe this was just header? */
if (io->len == sizeof(*hdr) && hdr->length > io->len) {
int reret;
+ void *newdata;
/* Enlarge and re-read. */
io->len = hdr->length;
- io->data = realloc(io->data, io->len);
- if (!io->data)
+ newdata = realloc(io->data, io->len);
+ if (!newdata)
return -1;
+ io->data = newdata;
/* Try reading again immediately. */
reret = read_io_elem(fd, io);
if (reret >= 0)