diff --git a/libdaemon/client/config-util.c b/libdaemon/client/config-util.c index 8aa9ed2e4..a65a2cce7 100644 --- a/libdaemon/client/config-util.c +++ b/libdaemon/client/config-util.c @@ -289,8 +289,9 @@ int buffer_append(struct buffer *buf, const char *string) { int len = strlen(string); - if (buf->allocated - buf->used <= len) - buffer_realloc(buf, len + 1); + if ((buf->allocated - buf->used <= len) && + !buffer_realloc(buf, len + 1)) + return 0; strcpy(buf->mem + buf->used, string); buf->used += len;