1.1 --- a/src/share/vm/runtime/os.cpp Thu Sep 19 09:26:08 2013 +0200 1.2 +++ b/src/share/vm/runtime/os.cpp Thu Sep 19 09:34:20 2013 +0200 1.3 @@ -459,6 +459,7 @@ 1.4 */ 1.5 void* os::find_agent_function(AgentLibrary *agent_lib, bool check_lib, 1.6 const char *syms[], size_t syms_len) { 1.7 + assert(agent_lib != NULL, "sanity check"); 1.8 const char *lib_name; 1.9 void *handle = agent_lib->os_lib(); 1.10 void *entryName = NULL; 1.11 @@ -489,6 +490,7 @@ 1.12 void *proc_handle; 1.13 void *save_handle; 1.14 1.15 + assert(agent_lib != NULL, "sanity check"); 1.16 if (agent_lib->name() == NULL) { 1.17 return false; 1.18 } 1.19 @@ -498,14 +500,13 @@ 1.20 // We want to look in this process' symbol table. 1.21 agent_lib->set_os_lib(proc_handle); 1.22 ret = find_agent_function(agent_lib, true, syms, syms_len); 1.23 - agent_lib->set_os_lib(save_handle); 1.24 if (ret != NULL) { 1.25 // Found an entry point like Agent_OnLoad_lib_name so we have a static agent 1.26 - agent_lib->set_os_lib(proc_handle); 1.27 agent_lib->set_valid(); 1.28 agent_lib->set_static_lib(true); 1.29 return true; 1.30 } 1.31 + agent_lib->set_os_lib(save_handle); 1.32 return false; 1.33 } 1.34