mirror of
https://github.com/mdbtools/mdbtools.git
synced 2026-03-10 00:20:54 +08:00
Replace malloc/free with g_malloc/g_free
This commit is contained in:
@@ -389,11 +389,11 @@ GtkCTreeNode *node, *container;
|
||||
int namelen;
|
||||
|
||||
namelen = fbuf[newbase];
|
||||
tmpstr = malloc(namelen + 1);
|
||||
tmpstr = g_malloc(namelen + 1);
|
||||
strncpy(tmpstr, &fbuf[newbase+1], namelen);
|
||||
tmpstr[namelen]=0;
|
||||
snprintf(str, 100, "Column %d: %s", i+1, tmpstr);
|
||||
free(tmpstr);
|
||||
g_free(tmpstr);
|
||||
node = gmdb_debug_add_item(dbug, container, str, newbase + 1, newbase + namelen);
|
||||
newbase += namelen + 1;
|
||||
}
|
||||
|
||||
@@ -112,9 +112,8 @@ gchar *titles[256];
|
||||
return;
|
||||
}
|
||||
for (i=0;i<sql->num_columns;i++) {
|
||||
bound_data[i] = (char *) malloc(MDB_BIND_SIZE);
|
||||
bound_data[i][0] = '\0';
|
||||
mdbsql_bind_column(sql, i+1, bound_data[i]);
|
||||
bound_data[i] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||
mdb_sql_bind_column(sql, i+1, bound_data[i]);
|
||||
sqlcol = g_ptr_array_index(sql->columns,i);
|
||||
titles[i] = sqlcol->name;
|
||||
}
|
||||
@@ -132,7 +131,7 @@ gchar *titles[256];
|
||||
|
||||
/* free the memory used to bind */
|
||||
for (i=0;i<sql->num_columns;i++) {
|
||||
free(bound_data[i]);
|
||||
g_free(bound_data[i]);
|
||||
}
|
||||
|
||||
mdb_sql_reset(sql);
|
||||
|
||||
@@ -70,8 +70,7 @@ GMdbDataWindow *dataw = NULL;
|
||||
|
||||
for (i=0;i<table->num_cols;i++) {
|
||||
/* bind columns */
|
||||
bound_data[i] = (char *) malloc(MDB_BIND_SIZE);
|
||||
bound_data[i][0] = '\0';
|
||||
bound_data[i] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||
mdb_bind_column(table, i+1, bound_data[i], NULL);
|
||||
|
||||
/* display column titles */
|
||||
@@ -87,7 +86,7 @@ GMdbDataWindow *dataw = NULL;
|
||||
|
||||
/* free the memory used to bind */
|
||||
for (i=0;i<table->num_cols;i++) {
|
||||
free(bound_data[i]);
|
||||
g_free(bound_data[i]);
|
||||
}
|
||||
|
||||
/* add this one to the window list */
|
||||
|
||||
@@ -105,8 +105,7 @@ char msg[100];
|
||||
|
||||
for (i=0;i<table->num_cols;i++) {
|
||||
/* bind columns */
|
||||
bound_data[i] = (char *) malloc(MDB_BIND_SIZE);
|
||||
bound_data[i][0] = '\0';
|
||||
bound_data[i] = (char *) g_malloc0(MDB_BIND_SIZE);
|
||||
mdb_bind_column(table, i+1, bound_data[i], NULL);
|
||||
|
||||
/* display column titles */
|
||||
@@ -134,7 +133,7 @@ char msg[100];
|
||||
|
||||
/* free the memory used to bind */
|
||||
for (i=0;i<table->num_cols;i++) {
|
||||
free(bound_data[i]);
|
||||
g_free(bound_data[i]);
|
||||
}
|
||||
|
||||
fclose(outfile);
|
||||
|
||||
Reference in New Issue
Block a user