diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-01-21 19:07:56 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2013-01-21 19:07:56 +0100 |
commit | 998300562e14f9d07293ec41e1aecca5930d5e6d (patch) | |
tree | b7d6fdaa365aaefa98c39483052bb94064660a28 /src/fastd.h | |
parent | 96c3ad683d87918fd0e6451d37934ba8b1d03867 (diff) | |
download | fastd-998300562e14f9d07293ec41e1aecca5930d5e6d.tar fastd-998300562e14f9d07293ec41e1aecca5930d5e6d.zip |
Add error message for OOM on buffer alloc
Diffstat (limited to 'src/fastd.h')
-rw-r--r-- | src/fastd.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/fastd.h b/src/fastd.h index 2dd0996..9223ffe 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -363,11 +363,11 @@ static inline size_t alignto(size_t l, size_t a) { return ((l+a-1)/a)*a; } -static inline fastd_buffer_t fastd_buffer_alloc(size_t len, size_t head_space, size_t tail_space) { +static inline fastd_buffer_t fastd_buffer_alloc(const fastd_context_t *ctx, size_t len, size_t head_space, size_t tail_space) { size_t base_len = head_space+len+tail_space; void *ptr; if (posix_memalign(&ptr, 16, base_len)) - return (fastd_buffer_t){ .base = NULL, .base_len = 0, .data = NULL, .len = 0 }; + exit_errno(ctx, "posix_memalign"); return (fastd_buffer_t){ .base = ptr, .base_len = base_len, .data = ptr+head_space, .len = len }; } |