Replace malloc/free with g_malloc/g_free

This commit is contained in:
whydoubt
2004-12-31 05:25:11 +00:00
parent 680e997365
commit f09f9438d3
9 changed files with 27 additions and 25 deletions

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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 */

View File

@@ -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);