提交 4cd07bc2 authored 作者: Jeff Lenk's avatar Jeff Lenk

fix code analysis warnings - this time while awake

上级 7fb6fb30
...@@ -391,8 +391,8 @@ ESL_DECLARE(int) esl_event_add_array(esl_event_t *event, const char *var, const ...@@ -391,8 +391,8 @@ ESL_DECLARE(int) esl_event_add_array(esl_event_t *event, const char *var, const
data = strdup(val + 7); data = strdup(val + 7);
len = (sizeof(char *) * max) + 1; len = (sizeof(char *) * max) + 1;
esl_assert(len);
array = malloc(len); array = malloc(len);
esl_assert(array);
memset(array, 0, len); memset(array, 0, len);
idx = esl_separate_string_string(data, "|:", array, max); idx = esl_separate_string_string(data, "|:", array, max);
...@@ -794,10 +794,12 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es ...@@ -794,10 +794,12 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es
if ((len + llen) > dlen) { if ((len + llen) > dlen) {
char *m; char *m;
char *old = buf;
dlen += (blocksize + (len + llen)); dlen += (blocksize + (len + llen));
if ((m = realloc(buf, dlen))) { if ((m = realloc(buf, dlen))) {
buf = m; buf = m;
} else { } else {
buf = old;
abort(); abort();
} }
} }
...@@ -821,10 +823,12 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es ...@@ -821,10 +823,12 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es
if ((len + llen) > dlen) { if ((len + llen) > dlen) {
char *m; char *m;
char *old = buf;
dlen += (blocksize + (len + llen)); dlen += (blocksize + (len + llen));
if ((m = realloc(buf, dlen))) { if ((m = realloc(buf, dlen))) {
buf = m; buf = m;
} else { } else {
buf = old;
abort(); abort();
} }
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论