mdbx: fix minor Coverity issues.

Change-Id: I21c44de18e4e620ecec38ec837446150736faf79
This commit is contained in:
Leonid Yuriev 2020-07-24 17:43:35 +03:00
parent 5f4f828bae
commit 2cd7fcb16d
2 changed files with 9 additions and 10 deletions

View File

@ -201,6 +201,7 @@ static int readhdr(void) {
str = valstr(dbuf.iov_base, "database");
if (str) {
if (*str) {
free(subname);
subname = mdbx_strdup(str);
if (!subname) {
perror("strdup()");
@ -216,6 +217,7 @@ static int readhdr(void) {
fprintf(stderr,
"%s: line %" PRIiSIZE ": unsupported value '%s' for %s\n", prog,
lineno, str, "type");
free(subname);
exit(EXIT_FAILURE);
}
continue;
@ -700,18 +702,13 @@ int main(int argc, char *argv[]) {
int batch = 0;
prevk.iov_len = 0;
while (rc == MDBX_SUCCESS) {
MDBX_val key;
MDBX_val key, data;
rc = readline(&key, &kbuf);
if (rc != MDBX_SUCCESS) /* rc == EOF */
if (rc == EOF)
break;
if (user_break) {
rc = MDBX_EINTR;
break;
}
MDBX_val data;
rc = readline(&data, &dbuf);
if (rc == MDBX_SUCCESS)
rc = readline(&data, &dbuf);
if (rc) {
fprintf(stderr, "%s: line %" PRIiSIZE ": failed to read key value\n",
prog, lineno);

View File

@ -1931,7 +1931,9 @@ __cold MDBX_INTERNAL_FUNC bin128_t mdbx_osal_bootid(void) {
(fstatfs(fd, &fs) == 0 && fs.f_type == /* procfs */ 0x9FA0)
? read(fd, buf, sizeof(buf))
: -1;
close(fd);
const int err = close(fd);
assert(err == 0);
(void)err;
if (len > 0 && bootid_parse_uuid(&bin, buf, len))
return bin;
}