summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-05-13 22:40:50 +0000
committerDavid Robillard <d@drobilla.net>2012-05-13 22:40:50 +0000
commitc334cb626d8a7c193453fac8a70cc7cdcd8a3f4e (patch)
tree6dc22bd96404f68c46f72669888760a4afd8cc45 /src
parentb3d2332e33356f654eeb90735812818fce9d28c5 (diff)
downloadlilv-c334cb626d8a7c193453fac8a70cc7cdcd8a3f4e.tar.gz
lilv-c334cb626d8a7c193453fac8a70cc7cdcd8a3f4e.tar.bz2
lilv-c334cb626d8a7c193453fac8a70cc7cdcd8a3f4e.zip
Gracefully handle allocation failure.
git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@4393 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/util.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index 789f5a6..b534ffd 100644
--- a/src/util.c
+++ b/src/util.c
@@ -65,7 +65,12 @@ lilv_strjoin(const char* first, ...)
break;
const size_t this_len = strlen(s);
- result = (char*)realloc(result, len + this_len + 1);
+ if (!(result = (char*)realloc(result, len + this_len + 1))) {
+ free(result);
+ LILV_ERROR("realloc() failed\n");
+ return NULL;
+ }
+
memcpy(result + len, s, this_len);
len += this_len;
}