summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2019-05-12 22:56:36 -0400
committerGlenn Strauss <gstrauss@gluelogic.com>2019-05-13 21:01:57 -0400
commit64b0f7229e3fae1c8f1c19e08b45685fc6a87d42 (patch)
tree00c850c9226a7aeab5563474c99fcae6df4f2e07
parenta86ea83b5a20eb75bc86a66f6feeb7f3c1520719 (diff)
downloadlighttpd1.4-64b0f7229e3fae1c8f1c19e08b45685fc6a87d42.tar.gz
lighttpd1.4-64b0f7229e3fae1c8f1c19e08b45685fc6a87d42.zip
[core] buffer_reset() should not be passed NULL
-rw-r--r--src/buffer.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 261adf55..8fea362f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -49,7 +49,6 @@ void buffer_free(buffer *b) {
__attribute_cold__
static void buffer_free_ptr(buffer *b) {
- if (NULL == b) return;
free(b->ptr);
b->ptr = NULL;
b->used = 0;
@@ -57,11 +56,10 @@ static void buffer_free_ptr(buffer *b) {
}
void buffer_reset(buffer *b) {
- if (NULL != b && b->size > 0) {
- b->used = 0;
- /* release buffer larger than ... bytes */
- if (b->size > BUFFER_MAX_REUSE_SIZE) buffer_free_ptr(b);
- }
+ force_assert(NULL != b);
+ b->used = 0;
+ /* release buffer larger than ... bytes */
+ if (b->size > BUFFER_MAX_REUSE_SIZE) buffer_free_ptr(b);
}
void buffer_move(buffer *b, buffer *src) {