Fix a couple of leaks

This commit is contained in:
whydoubt 2005-03-13 21:29:17 +00:00
parent f33a9564d1
commit 76c5cfe8c2
3 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,7 @@
Sun Mar 13 15:22:11 CST 2005 Jeff Smith <whydoubt@yahoo.com>
* src/util/mdb-export.c:
* src/util/mdb-ver.c: Fix a couple of leaks
Sat Mar 12 23:25:48 CST 2005 Jeff Smith <whydoubt@yahoo.com>
* include/mdbtools.h:
* src/libmdb/file.c:

View File

@ -53,9 +53,8 @@ main(int argc, char **argv)
MdbHandle *mdb;
MdbTableDef *table;
MdbColumn *col;
/* doesn't handle tables > 256 columns. Can that happen? */
char *bound_values[256];
int bound_lens[256];
char **bound_values;
int *bound_lens;
char *delimiter = NULL;
char *row_delimiter = NULL;
char header_row = 1;
@ -113,6 +112,8 @@ main(int argc, char **argv)
fprintf(stderr," -I INSERT statements (instead of CSV)\n");
fprintf(stderr," -D <format> set the date format (see strftime(3) for details)\n");
fprintf(stderr," -S Sanitize names (replace spaces etc. with underscore)\n");
g_free (delimiter);
g_free (row_delimiter);
exit(1);
}
@ -137,6 +138,8 @@ main(int argc, char **argv)
mdb_read_columns(table);
mdb_rewind_table(table);
bound_values = (char **) g_malloc(table->num_cols * sizeof(char *));
bound_lens = (int *) g_malloc(table->num_cols * sizeof(int));
for (j=0;j<table->num_cols;j++) {
bound_values[j] = (char *) g_malloc0(MDB_BIND_SIZE);
mdb_bind_column(table, j+1, bound_values[j], &bound_lens[j]);
@ -185,6 +188,8 @@ main(int argc, char **argv)
for (j=0;j<table->num_cols;j++) {
g_free(bound_values[j]);
}
g_free(bound_values);
g_free(bound_lens);
mdb_free_tabledef(table);
g_free (delimiter);

View File

@ -64,6 +64,7 @@ main(int argc, char **argv)
if (!(mdb = mdb_open(argv[optind], MDB_NOFLAGS))) {
fprintf(stderr,_("Error: unable to open file %s\n"),argv[optind]);
mdb_exit();
exit(1);
}
if (IS_JET3(mdb)) {