[GRASS-SVN] r50349 -
grass/branches/releasebranch_6_4/lib/db/dbmi_client
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jan 21 08:50:48 EST 2012
Author: mmetz
Date: 2012-01-21 05:50:48 -0800 (Sat, 21 Jan 2012)
New Revision: 50349
Modified:
grass/branches/releasebranch_6_4/lib/db/dbmi_client/column.c
Log:
db lib: fix memory leak (backport from trunk)
Modified: grass/branches/releasebranch_6_4/lib/db/dbmi_client/column.c
===================================================================
--- grass/branches/releasebranch_6_4/lib/db/dbmi_client/column.c 2012-01-21 13:25:35 UTC (rev 50348)
+++ grass/branches/releasebranch_6_4/lib/db/dbmi_client/column.c 2012-01-21 13:50:48 UTC (rev 50349)
@@ -39,6 +39,8 @@
dbColumn *column;
int ncol, cl, type;
+ type = -1;
+
db_init_string(&table_name);
db_set_string(&table_name, tab);
@@ -51,11 +53,14 @@
column = db_get_table_column(table, cl);
if (strcmp(db_get_column_name(column), col) == 0) {
type = db_get_column_sqltype(column);
- return type;
+ type = db_get_column_sqltype(column);
+ break;
}
}
- return -1;
+ db_free_table(table);
+
+ return type;
}
/*!
@@ -98,7 +103,7 @@
int db_get_column(dbDriver * Driver, const char *tname, const char *cname,
dbColumn ** Column)
{
- int i, ncols;
+ int i, ncols, ret;
dbTable *Table;
dbColumn *Col, *NCol;
dbString tabname;
@@ -112,6 +117,7 @@
}
*Column = NULL;
+ ret = DB_FAILED;
ncols = db_get_table_number_of_columns(Table);
G_debug(3, "ncol = %d", ncols);
@@ -138,8 +144,11 @@
NCol->update = Col->update;
*Column = NCol;
- return DB_OK;
+ ret = DB_OK;
+ break;
}
}
- return DB_OK;
+ db_free_table(Table);
+
+ return ret;
}
More information about the grass-commit
mailing list