[ 
https://issues.apache.org/jira/browse/GEODE-2713?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15941224#comment-15941224
 ] 

ASF GitHub Bot commented on GEODE-2713:
---------------------------------------

Github user pivotal-jbarrett commented on a diff in the pull request:

    https://github.com/apache/geode-native/pull/74#discussion_r108006001
  
    --- Diff: src/cppcache/src/ThinClientPoolDM.cpp ---
    @@ -609,7 +609,8 @@ GfErrType ThinClientPoolDM::sendRequestToAllServers(
       HostAsm::atomicAdd(m_clientOps, 1);
       getStats().setCurClientOps(m_clientOps);
     
    -  ACE_Recursive_Thread_Mutex resultCollectorLock;
    +  std::shared_ptr<ACE_Recursive_Thread_Mutex> resultCollectorLock(
    +      new ACE_Recursive_Thread_Mutex());
    --- End diff --
    
    The proper way to allocate a new object into a shared pointer:
    ```
    auto resultCollectorLock = std::make_shared<ACE_Recursive_Thread_Mutex>();
    ```
    
    This results in a single allocations (combined control block and object) 
rather than two (control block and object).



> Function execution can lead to passing the address of a stack variable
> ----------------------------------------------------------------------
>
>                 Key: GEODE-2713
>                 URL: https://issues.apache.org/jira/browse/GEODE-2713
>             Project: Geode
>          Issue Type: Bug
>          Components: native client
>            Reporter: Michael Dodge
>
> In ThinClientRegion::executeFunctionSH(), the address of a stack variable 
> (the result collector lock) is passed to the workers. If an exception occurs 
> with any of the workers, the function will return, causing the stack variable 
> to be destructed. Since the workers have the raw address, it is now a 
> dangling pointer situation.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to