diff options
author | David Robillard <d@drobilla.net> | 2012-05-13 22:41:07 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-13 22:41:07 +0000 |
commit | 070f0008cd590b04378830de27af2d9f73d1d304 (patch) | |
tree | 51d30c17316eb5352fcaf225a608c9b6c9d17c3a | |
parent | f9389e249506d4995fe281570d6d1aaa514b2fb9 (diff) | |
download | jalv-070f0008cd590b04378830de27af2d9f73d1d304.tar.gz jalv-070f0008cd590b04378830de27af2d9f73d1d304.tar.bz2 jalv-070f0008cd590b04378830de27af2d9f73d1d304.zip |
Gracefully handle allocation failure.
git-svn-id: http://svn.drobilla.net/lad/trunk/jalv@4394 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r-- | src/worker.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/worker.c b/src/worker.c index 51640e8..7d2448b 100644 --- a/src/worker.c +++ b/src/worker.c @@ -42,7 +42,12 @@ worker_func(void* data) uint32_t size = 0; jack_ringbuffer_read(jalv->worker.requests, (char*)&size, sizeof(size)); - buf = realloc(buf, size); + if (!(buf = realloc(buf, size))) { + fprintf(stderr, "error: realloc() failed\n"); + free(buf); + return NULL; + } + jack_ringbuffer_read(jalv->worker.requests, buf, size); jalv->worker.iface->work( |