mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-04-05 20:31:00 +08:00
Cleaning up memory for catalogs
This commit is contained in:
parent
f1bc789dda
commit
7b34e5e88c
@ -1,6 +1,8 @@
|
||||
Sat Apr 24 00:02:14 CDT 2004 Jeff Smith <whydoubt@yahoo.com>
|
||||
* src/libmdb/mem.c:
|
||||
* src/libmdb/catalog.c: Setting various pointers to NULL after freeing.
|
||||
* src/libmdb/mem.c:
|
||||
* src/libmdb/file.c: Cleaning up memory for catalogs
|
||||
|
||||
Fri Apr 16 10:48:05 EDT 2004 Brian Bruns <brian@bruns.com>
|
||||
* src/libmdb/write.c: restructuring of mdb_crack_row?() to accomodate
|
||||
|
@ -192,7 +192,7 @@ mdb_close(MdbHandle *mdb)
|
||||
MdbHandle *mdb_clone_handle(MdbHandle *mdb)
|
||||
{
|
||||
MdbHandle *newmdb;
|
||||
MdbCatalogEntry *entry;
|
||||
MdbCatalogEntry *entry, *data;
|
||||
int i;
|
||||
|
||||
newmdb = mdb_alloc_handle();
|
||||
@ -201,7 +201,8 @@ MdbHandle *mdb_clone_handle(MdbHandle *mdb)
|
||||
newmdb->catalog = g_ptr_array_new();
|
||||
for (i=0;i<mdb->num_catalog;i++) {
|
||||
entry = g_ptr_array_index(mdb->catalog,i);
|
||||
g_ptr_array_add(newmdb->catalog, entry);
|
||||
data = g_memdup(entry,sizeof(MdbCatalogEntry));
|
||||
g_ptr_array_add(newmdb->catalog, data);
|
||||
}
|
||||
mdb->backend_name = NULL;
|
||||
if (mdb->f) {
|
||||
|
@ -112,6 +112,12 @@ void mdb_alloc_catalog(MdbHandle *mdb)
|
||||
}
|
||||
void mdb_free_catalog(MdbHandle *mdb)
|
||||
{
|
||||
unsigned int i;
|
||||
MdbCatalogEntry *entry;
|
||||
for (i=0; i<mdb->catalog->len; i++) {
|
||||
entry = g_ptr_array_index(mdb->catalog, i);
|
||||
g_free (entry);
|
||||
}
|
||||
g_ptr_array_free(mdb->catalog, TRUE);
|
||||
mdb->catalog = NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user