mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-06 19:24:13 +08:00
mdbx: fix minor Coverity issues.
Change-Id: I21c44de18e4e620ecec38ec837446150736faf79
This commit is contained in:
parent
5f4f828bae
commit
2cd7fcb16d
@ -201,6 +201,7 @@ static int readhdr(void) {
|
|||||||
str = valstr(dbuf.iov_base, "database");
|
str = valstr(dbuf.iov_base, "database");
|
||||||
if (str) {
|
if (str) {
|
||||||
if (*str) {
|
if (*str) {
|
||||||
|
free(subname);
|
||||||
subname = mdbx_strdup(str);
|
subname = mdbx_strdup(str);
|
||||||
if (!subname) {
|
if (!subname) {
|
||||||
perror("strdup()");
|
perror("strdup()");
|
||||||
@ -216,6 +217,7 @@ static int readhdr(void) {
|
|||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"%s: line %" PRIiSIZE ": unsupported value '%s' for %s\n", prog,
|
"%s: line %" PRIiSIZE ": unsupported value '%s' for %s\n", prog,
|
||||||
lineno, str, "type");
|
lineno, str, "type");
|
||||||
|
free(subname);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@ -700,18 +702,13 @@ int main(int argc, char *argv[]) {
|
|||||||
int batch = 0;
|
int batch = 0;
|
||||||
prevk.iov_len = 0;
|
prevk.iov_len = 0;
|
||||||
while (rc == MDBX_SUCCESS) {
|
while (rc == MDBX_SUCCESS) {
|
||||||
MDBX_val key;
|
MDBX_val key, data;
|
||||||
rc = readline(&key, &kbuf);
|
rc = readline(&key, &kbuf);
|
||||||
if (rc != MDBX_SUCCESS) /* rc == EOF */
|
if (rc == EOF)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (user_break) {
|
if (rc == MDBX_SUCCESS)
|
||||||
rc = MDBX_EINTR;
|
rc = readline(&data, &dbuf);
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
MDBX_val data;
|
|
||||||
rc = readline(&data, &dbuf);
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
fprintf(stderr, "%s: line %" PRIiSIZE ": failed to read key value\n",
|
fprintf(stderr, "%s: line %" PRIiSIZE ": failed to read key value\n",
|
||||||
prog, lineno);
|
prog, lineno);
|
||||||
|
@ -1931,7 +1931,9 @@ __cold MDBX_INTERNAL_FUNC bin128_t mdbx_osal_bootid(void) {
|
|||||||
(fstatfs(fd, &fs) == 0 && fs.f_type == /* procfs */ 0x9FA0)
|
(fstatfs(fd, &fs) == 0 && fs.f_type == /* procfs */ 0x9FA0)
|
||||||
? read(fd, buf, sizeof(buf))
|
? read(fd, buf, sizeof(buf))
|
||||||
: -1;
|
: -1;
|
||||||
close(fd);
|
const int err = close(fd);
|
||||||
|
assert(err == 0);
|
||||||
|
(void)err;
|
||||||
if (len > 0 && bootid_parse_uuid(&bin, buf, len))
|
if (len > 0 && bootid_parse_uuid(&bin, buf, len))
|
||||||
return bin;
|
return bin;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user