summaryrefslogtreecommitdiffstats
path: root/src/basic/strbuf.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:09:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-16 18:09:49 +0000
commit022569715958759a1a5ff2df820865dfc1cafecb (patch)
tree69a337167ecc86395624f53ab5cb11faadab411b /src/basic/strbuf.c
parentReleasing progress-linux version 256-2~progress7.99u1. (diff)
downloadsystemd-022569715958759a1a5ff2df820865dfc1cafecb.tar.xz
systemd-022569715958759a1a5ff2df820865dfc1cafecb.zip
Merging upstream version 256.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/basic/strbuf.c')
-rw-r--r--src/basic/strbuf.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/basic/strbuf.c b/src/basic/strbuf.c
index 0617acc..6d43955 100644
--- a/src/basic/strbuf.c
+++ b/src/basic/strbuf.c
@@ -107,7 +107,6 @@ static void bubbleinsert(struct strbuf_node *node,
/* add string, return the index/offset into the buffer */
ssize_t strbuf_add_string(struct strbuf *str, const char *s, size_t len) {
uint8_t c;
- char *buf_new;
struct strbuf_child_entry *child;
struct strbuf_node *node;
ssize_t off;
@@ -147,10 +146,8 @@ ssize_t strbuf_add_string(struct strbuf *str, const char *s, size_t len) {
}
/* add new string */
- buf_new = realloc(str->buf, str->len + len+1);
- if (!buf_new)
+ if (!GREEDY_REALLOC(str->buf, str->len + len + 1))
return -ENOMEM;
- str->buf = buf_new;
off = str->len;
memcpy(str->buf + off, s, len);
str->len += len;