ITS#9160 OOM handling in mdb tools

This commit is contained in:
Ondřej Kuzník 2020-01-30 08:59:57 +00:00
parent 9835662927
commit be61a967e6
2 changed files with 8 additions and 0 deletions

View File

@ -279,6 +279,10 @@ int main(int argc, char *argv[])
continue;
count++;
str = malloc(key.mv_size+1);
if (!str) {
fprintf(stderr, "malloc failed\n");
goto txn_abort;
}
memcpy(str, key.mv_data, key.mv_size);
str[key.mv_size] = '\0';
rc = mdb_open(txn, str, 0, &db2);

View File

@ -232,6 +232,10 @@ int main(int argc, char *argv[])
if (memchr(key.mv_data, '\0', key.mv_size))
continue;
str = malloc(key.mv_size+1);
if (!str) {
fprintf(stderr, "malloc failed\n");
goto txn_abort;
}
memcpy(str, key.mv_data, key.mv_size);
str[key.mv_size] = '\0';
rc = mdb_open(txn, str, 0, &db2);