[
https://issues.apache.org/jira/browse/AXIS2C-1491?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Lazarski resolved AXIS2C-1491.
-------------------------------------
Fix Version/s: 2.0.0
(was: 1.7.0)
Resolution: Fixed
Issue: Memory leak in arch_reader.c when file_flag is set (when AXIS2C_HOME
points to an axis2.xml file instead of a directory).
Root cause: Inconsistent API semantics - axis2_dep_engine_get_repos_path()
returns an internal pointer (no free needed), but
axis2_dep_engine_get_svc_dir() and axis2_dep_engine_get_module_dir() return
allocated strings via axutil_strdup (must be freed).
Fix: Added AXIS2_FREE(env->allocator, repos_path) after using the allocated
strings in:
- axis2_arch_reader_process_svc_grp() (line 108)
- axis2_arch_reader_read_module_arch() (line 276)
All tests pass (deployment tests, clientapi tests, native codegen tests -
75/75).
> memory leak at axis2_dep_engine_get_svc_dir
> -------------------------------------------
>
> Key: AXIS2C-1491
> URL: https://issues.apache.org/jira/browse/AXIS2C-1491
> Project: Axis2-C
> Issue Type: Bug
> Components: core/deployment
> Affects Versions: 1.6.0
> Environment: debian Linux
> Reporter: H.Wang
> Priority: Major
> Fix For: 2.0.0
>
>
> I see the following memory leaks from the axis2c client stub code. When the
> file_flag is set, "repos_path = axis2_dep_engine_get_svc_dir (dep_engine,
> env);" allocates new memory, but at nowhere this memory is freed. It appears
> that this leak occurs when AXIS2C_HOME points to the axis2.xml file instead
> of the directory that holds axis2c.xml. We set AXIS2C_HOME to the axis2.xml
> file because we have both axis2c server component and client sub on the same
> system, and they need to point to different axis2c.xml files.
> ==19955== 14 bytes in 1 blocks are definitely lost in loss record 652 of 809
> ==19955== at 0x401D354: malloc (vg_replace_malloc.c:149)
> ==19955== by 0x4DFDEFC: axutil_allocator_malloc_impl (allocator.c:75)
> ==19955== by 0x4E0129E: axutil_strdup (string.c:282)
> ==19955== by 0x4DC1B96: axis2_dep_engine_get_svc_dir (dep_engine.c:1937)
> ==19955== by 0x4DC161E: axis2_arch_reader_process_svc_grp
> (arch_reader.c:108)
> ==19955== by 0x4DC2DB9: axis2_dep_engine_do_deploy (dep_engine.c:1509)
> ==19955== by 0x4DC60CE: axis2_ws_info_list_update (ws_info_list.c:398)
> ==19955== by 0x4DCCB75: axis2_repos_listener_update (repos_listener.c:281)
> ==19955== by 0x4DCD16B: axis2_repos_listener_init (repos_listener.c:307)
> ==19955== by 0x4DCD299:
> axis2_repos_listener_create_with_folder_name_and_dep_engine
> (repos_listener.c:130)
> ==19955== by 0x4DC3D2A: axis2_dep_engine_load_client (dep_engine.c:962)
> ==19955== by 0x4DCD7DF: axis2_build_client_conf_ctx (conf_init.c:192)
> ==19955== by 0x4DDE235: axis2_svc_client_create_with_conf_ctx_and_svc
> (svc_client.c:1086)
> ==19955== by 0x4DDE64F: axis2_svc_client_create (svc_client.c:122)
> ==19955== by 0x4DD7B94:
> axis2_stub_create_with_endpoint_ref_and_client_home (stub.c:67)
> ==19955== by 0x430D2A6: axis2_stub_create_Service (axis2_stub_Service.c:33)
> The leak comes from the following code,
> AXIS2_EXTERN axis2_status_t AXIS2_CALL
> axis2_arch_reader_process_svc_grp(
> axis2_arch_reader_t * arch_reader,
> const axutil_env_t * env,
> axis2_char_t * file_name,
> struct axis2_dep_engine * dep_engine,
> axis2_svc_grp_t * svc_grp)
> {
> axis2_status_t status = AXIS2_FAILURE;
> axis2_char_t *svc_grp_xml = NULL;
> axis2_char_t *repos_path = NULL;
> axis2_bool_t file_flag = AXIS2_FALSE;
> AXIS2_PARAM_CHECK(env->error, file_name, AXIS2_FAILURE);
> AXIS2_PARAM_CHECK(env->error, dep_engine, AXIS2_FAILURE);
> AXIS2_PARAM_CHECK(env->error, svc_grp, AXIS2_FAILURE);
> file_flag = axis2_dep_engine_get_file_flag (dep_engine, env);
> if (!file_flag)
> {
> repos_path = axis2_dep_engine_get_repos_path(dep_engine, env);
> svc_grp_xml = axutil_strcat(env, repos_path, AXIS2_PATH_SEP_STR,
> AXIS2_SERVICE_FOLDER, AXIS2_PATH_SEP_STR,
> file_name, AXIS2_PATH_SEP_STR, AXIS2_SVC_XML,
> NULL);
> }
> else
> {
> repos_path = axis2_dep_engine_get_svc_dir (dep_engine, env);
> svc_grp_xml = axutil_strcat (env, repos_path, AXIS2_PATH_SEP_STR,
> file_name, AXIS2_PATH_SEP_STR,
> AXIS2_SVC_XML,
> NULL);
> }
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]