FS-11785 [esl] dead assignments in esl_event_serialize

null attribute in esl_buffer_read
	       null attribute in esl_event_base_add_header
	       null attribute in esl_recv_event
This commit is contained in:
Chris Rienzo 2019-04-15 22:51:54 -04:00 committed by Andrey Volk
parent c776680c56
commit ca8fa0e1ff
3 changed files with 3 additions and 5 deletions

View File

@ -1459,7 +1459,7 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_
}
}
if ((cl = esl_event_get_header(handle->last_ievent, "content-length"))) {
if (beg && (cl = esl_event_get_header(handle->last_ievent, "content-length"))) {
handle->last_ievent->body = strdup(beg);
}

View File

@ -176,6 +176,7 @@ ESL_DECLARE(esl_size_t) esl_buffer_read(esl_buffer_t *buffer, void *data, esl_si
esl_assert(buffer != NULL);
esl_assert(data != NULL);
esl_assert(buffer->head != NULL);
if (buffer->used < 1) {

View File

@ -549,6 +549,7 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st
redraw:
len = 0;
for(j = 0; j < header->idx; j++) {
esl_assert(header->array[j]);
len += strlen(header->array[j]) + 2;
}
@ -835,12 +836,10 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es
if ((len + llen) > dlen) {
char *m;
char *old = buf;
dlen += (blocksize + (len + llen));
if ((m = realloc(buf, dlen))) {
buf = m;
} else {
buf = old;
abort();
}
}
@ -864,12 +863,10 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es
if ((len + llen) > dlen) {
char *m;
char *old = buf;
dlen += (blocksize + (len + llen));
if ((m = realloc(buf, dlen))) {
buf = m;
} else {
buf = old;
abort();
}
}