diff options
author | David Robillard <d@drobilla.net> | 2012-05-13 22:40:50 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-13 22:40:50 +0000 |
commit | c334cb626d8a7c193453fac8a70cc7cdcd8a3f4e (patch) | |
tree | 6dc22bd96404f68c46f72669888760a4afd8cc45 | |
parent | b3d2332e33356f654eeb90735812818fce9d28c5 (diff) | |
download | lilv-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
-rw-r--r-- | src/util.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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; } |