summaryrefslogtreecommitdiff
path: root/librabbitmq/amqp_consumer.c
diff options
context:
space:
mode:
Diffstat (limited to 'librabbitmq/amqp_consumer.c')
-rw-r--r--librabbitmq/amqp_consumer.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/librabbitmq/amqp_consumer.c b/librabbitmq/amqp_consumer.c
index 29da9ed..6fb5b96 100644
--- a/librabbitmq/amqp_consumer.c
+++ b/librabbitmq/amqp_consumer.c
@@ -242,11 +242,15 @@ amqp_rpc_reply_t amqp_read_message(amqp_connection_state_t state,
goto error_out3;
}
- message->body = amqp_bytes_malloc(frame.payload.properties.body_size);
- if (NULL == message->body.bytes) {
- ret.reply_type = AMQP_RESPONSE_LIBRARY_EXCEPTION;
- ret.library_error = AMQP_STATUS_NO_MEMORY;
- goto error_out1;
+ if (0 == frame.payload.properties.body_size) {
+ message->body = amqp_empty_bytes;
+ } else {
+ message->body = amqp_bytes_malloc(frame.payload.properties.body_size);
+ if (NULL == message->body.bytes) {
+ ret.reply_type = AMQP_RESPONSE_LIBRARY_EXCEPTION;
+ ret.library_error = AMQP_STATUS_NO_MEMORY;
+ goto error_out1;
+ }
}
body_read = 0;