mirror of
https://github.com/mdbtools/mdbtools.git
synced 2025-11-26 10:29:27 +08:00
malloc to g_malloc for backend functions
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
Sat May 29 14:14:21 CDT 2004 Jeff Smith <whydoubt@yahoo.com>
|
||||
* src/libmdb/backend.c:
|
||||
* src/libmdb/file.c: malloc to g_malloc for backend functions
|
||||
|
||||
Fri May 28 06:55:55 CDT 2004 Jeff Smith <whydoubt@yahoo.com>
|
||||
* src/libmdb/mem.c: Fixed a couple of potential memory leaks
|
||||
* include/mdbtools.h: Fixed a couple of compiler warnings
|
||||
|
||||
@@ -210,8 +210,7 @@ MdbBackend *backend;
|
||||
backend = (MdbBackend *) g_hash_table_lookup(mdb_backends, backend_name);
|
||||
if (backend) {
|
||||
mdb->default_backend = backend;
|
||||
mdb->backend_name = (char *) malloc(strlen(backend_name)+1);
|
||||
strcpy(mdb->backend_name, backend_name);
|
||||
mdb->backend_name = (char *) g_strdup(backend_name);
|
||||
did_first = 0;
|
||||
return 1;
|
||||
} else {
|
||||
@@ -237,14 +236,14 @@ do_first (MdbHandle *mdb)
|
||||
mdb_read_columns(table);
|
||||
mdb_rewind_table(table);
|
||||
for (k=0;k<table->num_cols;k++) {
|
||||
bound_values[k] = (char *) malloc(MDB_BIND_SIZE);
|
||||
bound_values[k] = (char *) g_malloc(MDB_BIND_SIZE);
|
||||
bound_values[k][0] = '\0';
|
||||
mdb_bind_column(table,k+1,bound_values[k]);
|
||||
}
|
||||
relationships[0] = (char *) malloc(256); /* child column */
|
||||
relationships[1] = (char *) malloc(256); /* child table */
|
||||
relationships[2] = (char *) malloc(256); /* parent column */
|
||||
relationships[3] = (char *) malloc(256); /* parent table */
|
||||
relationships[0] = (char *) g_malloc(256); /* child column */
|
||||
relationships[1] = (char *) g_malloc(256); /* child table */
|
||||
relationships[2] = (char *) g_malloc(256); /* parent column */
|
||||
relationships[3] = (char *) g_malloc(256); /* parent table */
|
||||
} /* if num_rows > 0 */
|
||||
did_first = 1;
|
||||
return;
|
||||
@@ -296,12 +295,12 @@ static char text[255];
|
||||
} /* got a row */
|
||||
} else {
|
||||
for (k=0;k<table->num_cols;k++) {
|
||||
free(bound_values[k]);
|
||||
g_free(bound_values[k]);
|
||||
}
|
||||
free(relationships[0]);
|
||||
free(relationships[1]);
|
||||
free(relationships[2]);
|
||||
free(relationships[3]);
|
||||
g_free(relationships[0]);
|
||||
g_free(relationships[1]);
|
||||
g_free(relationships[2]);
|
||||
g_free(relationships[3]);
|
||||
did_first = 0;
|
||||
}
|
||||
return text;
|
||||
|
||||
@@ -127,7 +127,7 @@ MdbFile *f;
|
||||
fprintf(stderr, "Can't alloc filename\n");
|
||||
free(f->filename);
|
||||
free(f);
|
||||
if (mdb->backend_name) free(mdb->backend_name);
|
||||
g_free(mdb->backend_name);
|
||||
free(mdb);
|
||||
return NULL;
|
||||
}
|
||||
@@ -179,7 +179,7 @@ mdb_close(MdbHandle *mdb)
|
||||
if (!mdb) return;
|
||||
mdb_free_stats(mdb);
|
||||
mdb_free_catalog(mdb);
|
||||
if (mdb->backend_name) free(mdb->backend_name);
|
||||
g_free(mdb->backend_name);
|
||||
|
||||
if (mdb->f) {
|
||||
if (mdb->f->refs > 1) {
|
||||
|
||||
Reference in New Issue
Block a user