dtinfo: Fix coverity issues for resource leaks
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -191,8 +191,10 @@ DtMmdbHandle** DtMmdbBookGetTabList(DtMmdbInfoRequest* request, unsigned int* le
|
||||
|
||||
while (*desc != '\0' && *desc != '\t') desc++;
|
||||
|
||||
if (*desc != '\t')
|
||||
if (*desc != '\t') {
|
||||
free(u);
|
||||
return 0;
|
||||
}
|
||||
|
||||
desc++;
|
||||
|
||||
|
||||
@@ -413,15 +413,17 @@ Boolean page::_alloc_slot( int slot_num, int size, char*& str_ptr )
|
||||
|
||||
int new_blank_len = slot_info -> string_leng() ;
|
||||
|
||||
if ( new_blank_len < size )
|
||||
if ( new_blank_len < size ) {
|
||||
delete slot_info;
|
||||
return false;
|
||||
}
|
||||
|
||||
slot_info -> set_string_ofst( end_ptr );
|
||||
slot_info -> set_string_leng( size );
|
||||
slot_info -> set_mode(spointer_t::DELETED, false);
|
||||
slot_info -> set_forward_ptr(0);
|
||||
|
||||
delete slot_info;
|
||||
delete slot_info;
|
||||
|
||||
if ( slot_num == count() ) {
|
||||
|
||||
|
||||
@@ -698,8 +698,10 @@ int page_storage::deleteString(mmdb_pos_t loc, Boolean flush_opt)
|
||||
|
||||
spointer_t *x = y -> get_spointer(slot_num);
|
||||
|
||||
if ( x -> get_mode(spointer_t::DELETED) == true )
|
||||
if ( x -> get_mode(spointer_t::DELETED) == true ) {
|
||||
delete x;
|
||||
return 0;
|
||||
}
|
||||
|
||||
loc = x -> forward_ptr();
|
||||
//debug(cerr, loc);
|
||||
|
||||
@@ -38,6 +38,7 @@ string::string(char* str, int size)
|
||||
|
||||
string::~string()
|
||||
{
|
||||
delete sbuf;
|
||||
}
|
||||
|
||||
char* string::c_str()
|
||||
|
||||
Reference in New Issue
Block a user