[Groonga-mysql-commit] mroonga/mroonga at 4ca64bc [master] Use copied path for normalized_path

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Feb 17 00:00:23 JST 2015


Kouhei Sutou	2015-02-17 00:00:23 +0900 (Tue, 17 Feb 2015)

  New Revision: 4ca64bcd7a99d18b7bf5fe68ad6ff22161270a71
  https://github.com/mroonga/mroonga/commit/4ca64bcd7a99d18b7bf5fe68ad6ff22161270a71

  Message:
    Use copied path for normalized_path
    
    Because normalized_path may be changed in `open_table_def()`.

  Modified files:
    mrn_table.cpp

  Modified: mrn_table.cpp (+5 -3)
===================================================================
--- mrn_table.cpp    2015-02-16 23:52:52 +0900 (4192108)
+++ mrn_table.cpp    2015-02-17 00:00:23 +0900 (4fec67b)
@@ -1030,9 +1030,9 @@ TABLE_SHARE *mrn_create_tmp_table_share(TABLE_LIST *table_list, const char *path
   }
   share->tmp_table = INTERNAL_TMP_TABLE; // TODO: is this right?
   share->path.str = (char *) path;
-  share->path.length = strlen(path);
-  share->normalized_path.str = share->path.str;
-  share->normalized_path.length = share->path.length;
+  share->path.length = strlen(share->path.str);
+  share->normalized_path.str = my_strdup(path, MYF(MY_WME));
+  share->normalized_path.length = strlen(share->normalized_path.str);
   if (open_table_def(thd, share, GTS_TABLE))
   {
     *error = ER_CANT_OPEN_FILE;
@@ -1044,7 +1044,9 @@ TABLE_SHARE *mrn_create_tmp_table_share(TABLE_LIST *table_list, const char *path
 void mrn_free_tmp_table_share(TABLE_SHARE *tmp_table_share)
 {
   MRN_DBUG_ENTER_FUNCTION();
+  char *normalized_path = tmp_table_share->normalized_path.str;
   free_table_share(tmp_table_share);
+  my_free(normalized_path);
   DBUG_VOID_RETURN;
 }
 
-------------- next part --------------
HTML����������������������������...
Descargar 



More information about the Groonga-mysql-commit mailing list
Back to archive index