Kouhei Sutou
null+****@clear*****
Mon May 20 12:27:41 JST 2013
Kouhei Sutou 2013-05-20 12:27:41 +0900 (Mon, 20 May 2013) New Revision: ff4046c8040cc77abad856d906b247e6dc1dc2e8 https://github.com/groonga/groonga/commit/ff4046c8040cc77abad856d906b247e6dc1dc2e8 Message: windows: use static buffer instead of dynamic allocated buffer This is not a memory leak but some tools may detect it as a memory leak. Modified files: lib/plugin.c Modified: lib/plugin.c (+5 -8) =================================================================== --- lib/plugin.c 2013-05-20 00:47:46 +0900 (8a41b7c) +++ lib/plugin.c 2013-05-20 12:27:41 +0900 (369ccba) @@ -298,25 +298,22 @@ grn_plugin_register_by_path(grn_ctx *ctx, const char *path) #ifdef WIN32 static char *win32_plugins_dir = NULL; +static char win32_plugins_dir_buffer[PATH_MAX]; const char * grn_plugin_get_system_plugins_dir(void) { if (!win32_plugins_dir) { const char *base_dir; const char *relative_path = GRN_RELATIVE_PLUGINS_DIR; - char *plugins_dir; char *path; size_t base_dir_length; base_dir = grn_win32_base_dir(); base_dir_length = strlen(base_dir); - plugins_dir = malloc(base_dir_length + - strlen("/lib/") + - strlen(relative_path)); - strcpy(plugins_dir, base_dir); - strcat(plugins_dir, "/lib/"); - strcat(plugins_dir, relative_path); - win32_plugins_dir = plugins_dir; + strcpy(win32_plugins_dir_buffer, base_dir); + strcat(win32_plugins_dir_buffer, "/lib/"); + strcat(win32_plugins_dir_buffer, relative_path); + win32_plugins_dir = win32_plugins_dir_buffer; } return win32_plugins_dir; } -------------- next part -------------- HTML����������������������������... ダウンロード