dtinfo: Fix coverity issues for resource leaks

This commit is contained in:
Peter Howkins
2018-04-04 22:07:10 +01:00
parent 9ef3b9ec68
commit 2b15c4057e
11 changed files with 47 additions and 13 deletions

View File

@@ -172,8 +172,10 @@ __bt_sync(dbp, flags)
if (ISSET(t, B_DELCRSR)) {
if ((p = (void*)malloc(t->bt_psize)) == NULL)
return (RET_ERROR);
if ((h = mpool_get(t->bt_mp, t->bt_bcursor.pgno, 0)) == NULL)
if ((h = mpool_get(t->bt_mp, t->bt_bcursor.pgno, 0)) == NULL) {
free(p);
return (RET_ERROR);
}
memmove(p, h, t->bt_psize);
if ((status =
__bt_dleaf(t, h, t->bt_bcursor.index)) == RET_ERROR)
@@ -185,8 +187,10 @@ __bt_sync(dbp, flags)
CLR(t, B_MODIFIED);
ecrsr: if (ISSET(t, B_DELCRSR)) {
if ((h = mpool_get(t->bt_mp, t->bt_bcursor.pgno, 0)) == NULL)
if ((h = mpool_get(t->bt_mp, t->bt_bcursor.pgno, 0)) == NULL) {
free(p);
return (RET_ERROR);
}
memmove(h, p, t->bt_psize);
free(p);
mpool_put(t->bt_mp, h, MPOOL_DIRTY);