diff --git a/tools/acrn-crashlog/acrnprobe/load_conf.c b/tools/acrn-crashlog/acrnprobe/load_conf.c index 3bfa9121c..75e4fd4a2 100644 --- a/tools/acrn-crashlog/acrnprobe/load_conf.c +++ b/tools/acrn-crashlog/acrnprobe/load_conf.c @@ -629,14 +629,17 @@ static int parse_uptime(xmlNodePtr cur, struct sender_t *sender) else if (name_is(cur, "eventhours")) res = load_cur_content(cur, uptime, eventhours); - if (res) + if (res) { + free(uptime); return -1; + } cur = cur->next; } res = asprintf(&uptime->path, "%s/uptime", sender->outdir); if (res < 0) { LOGE("build string failed\n"); + free(uptime); return -1; } sender->uptime = uptime; diff --git a/tools/acrn-crashlog/common/fsutils.c b/tools/acrn-crashlog/common/fsutils.c index 99833259e..1e4998d2e 100644 --- a/tools/acrn-crashlog/common/fsutils.c +++ b/tools/acrn-crashlog/common/fsutils.c @@ -686,12 +686,12 @@ static ssize_t _file_read_key_value(char *value, const size_t limit, return -errno; if (!key) { errno = EINVAL; - return -errno; + goto unmap; } if (op != 'l' && op != 'r') { errno = EINVAL; - return -errno; + goto unmap; } if (op == 'l')