瀏覽代碼

fix https://trac.osgeo.org/grass/changeset/45515 - incorect usage of db_free_string() on `char *`
(merge https://trac.osgeo.org/grass/changeset/45671 from relbr64)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@45673 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 14 年之前
父節點
當前提交
46a5190495
共有 4 個文件被更改,包括 5 次插入6 次删除
  1. 2 2
      lib/db/dbmi_base/error.c
  2. 0 1
      lib/db/dbmi_base/value.c
  3. 1 1
      lib/db/dbmi_driver/d_close_cur.c
  4. 2 2
      lib/db/dbmi_driver/driver_state.c

+ 2 - 2
lib/db/dbmi_base/error.c

@@ -33,7 +33,7 @@ void db_on_error(void (*f) (const char *))
 void db_set_error_who(const char *me)
 void db_set_error_who(const char *me)
 {
 {
     if (who)
     if (who)
-	db_free_string(who);
+	db_free(who);
     who = db_store(me);
     who = db_store(me);
 }
 }
 
 
@@ -59,7 +59,7 @@ void db_error(const char *s)
     if (s == NULL)
     if (s == NULL)
 	s = "<NULL error message>";
 	s = "<NULL error message>";
     if (err_msg)
     if (err_msg)
-	db_free_string(err_msg);
+	db_free(err_msg);
     err_msg = db_store(s);
     err_msg = db_store(s);
     err_flag = 1;
     err_flag = 1;
     if (auto_print_errors)
     if (auto_print_errors)

+ 0 - 1
lib/db/dbmi_base/value.c

@@ -353,7 +353,6 @@ void db_CatValArray_free(dbCatValArray * arr)
 	for (i = 0; i < arr->n_values; i++) {
 	for (i = 0; i < arr->n_values; i++) {
 	    if (arr->ctype == DB_C_TYPE_STRING && arr->value[i].val.s) {
 	    if (arr->ctype == DB_C_TYPE_STRING && arr->value[i].val.s) {
 		db_free_string(arr->value[i].val.s);
 		db_free_string(arr->value[i].val.s);
-		db_free(arr->value[i].val.s);
 	    }
 	    }
 	    if (arr->ctype == DB_C_TYPE_DATETIME && arr->value[i].val.t) {
 	    if (arr->ctype == DB_C_TYPE_DATETIME && arr->value[i].val.t) {
 		db_free(arr->value[i].val.t);
 		db_free(arr->value[i].val.t);

+ 1 - 1
lib/db/dbmi_driver/d_close_cur.c

@@ -44,7 +44,7 @@ int db_d_close_cursor(void)
     db_drop_token(token);
     db_drop_token(token);
     db_free_cursor(cursor);
     db_free_cursor(cursor);
     db__drop_cursor_from_driver_state(cursor);
     db__drop_cursor_from_driver_state(cursor);
-    db_free(cursor);
+    db_free(cursor); /* ?? */
 
 
     /* send the return code */
     /* send the return code */
     if (stat != DB_OK) {
     if (stat != DB_OK) {

+ 2 - 2
lib/db/dbmi_driver/driver_state.c

@@ -66,8 +66,8 @@ void db__mark_database_open(const char *dbname, const char *dbschema)
 */
 */
 void db__mark_database_closed(void)
 void db__mark_database_closed(void)
 {
 {
-    db_free_string(state.dbname);
-    db_free_string(state.dbschema);
+    db_free(state.dbname);
+    db_free(state.dbschema);
     state.open = 0;
     state.open = 0;
 }
 }