Fixed a couple of potential memory leaks

This commit is contained in:
whydoubt
2004-05-28 12:20:17 +00:00
parent 39aaec1a75
commit 809ba65541
2 changed files with 20 additions and 11 deletions

View File

@@ -1,3 +1,6 @@
Fri May 28 06:55:55 CDT 2004 Jeff Smith <whydoubt@yahoo.com>
* src/libmdb/mem.c: Fixed a couple of potential memory leaks
Sun May 2 06:31:17 EDT 2004 Brian Bruns <brian@bruns.com>
* src/util/mdb-tables.c: Add -t flag to specify object type
* src/util/mdb-props.c: Handle any object type, not just tables

View File

@@ -72,14 +72,10 @@ void mdb_alloc_catalog(MdbHandle *mdb)
void mdb_free_catalog(MdbHandle *mdb)
{
unsigned int i;
MdbCatalogEntry *entry;
if (!mdb->catalog) return;
for (i=0; i<mdb->catalog->len; i++) {
entry = g_ptr_array_index(mdb->catalog, i);
g_free (entry);
}
for (i=0; i<mdb->catalog->len; i++)
g_free (g_ptr_array_index(mdb->catalog, i));
g_ptr_array_free(mdb->catalog, TRUE);
mdb->catalog = NULL;
}
@@ -115,6 +111,11 @@ MdbColumn *col;
void
mdb_free_columns(GPtrArray *columns)
{
unsigned int i;
if (!columns) return;
for (i=0; i<columns->len; i++)
g_free (g_ptr_array_index(columns, i));
g_ptr_array_free(columns, TRUE);
}
@@ -129,5 +130,10 @@ MdbIndex *idx;
void
mdb_free_indices(GPtrArray *indices)
{
unsigned int i;
if (!indices) return;
for (i=0; i<indices->len; i++)
g_free (g_ptr_array_index(indices, i));
g_ptr_array_free(indices, TRUE);
}