#50833 Ticket 50709 - (cont) Several memory leaks reported by Valgrind for 389-ds 1.3.9.1-10
Closed 3 years ago by spichugi. Opened 4 years ago by tbordaz.
tbordaz/389-ds-base ticket_50709_cont  into  master

@@ -305,7 +305,10 @@ 

          slapi_log_err(SLAPI_LOG_ACL, plugin_name, "DS_LASIpGetter - "

                                                    "Returning client ip address 'unknown'\n");

      }

-     slapi_pblock_set(aclpb->aclpb_pblock, SLAPI_CONN_CLIENTNETADDR_ACLIP, client_praddr);

+     if (client_praddr != pb_client_praddr) {

+         /* Set it in pblock only if it is newly allocated */

+         slapi_pblock_set(aclpb->aclpb_pblock, SLAPI_CONN_CLIENTNETADDR_ACLIP, client_praddr);

+     }

      return LAS_EVAL_TRUE;

  }

  

Description of the problem:

Original fix was incorrect as it set again in pblock (SLAPI_CONN_CLIENTNETADDR_ACLIP)
    the same structure. As old structure is freed during the slapi_pblock_set,
pblock refers to a freed structure.
    Later an other threads using the same aclpb contain will use it after free

Description of the fix:
Only sets in pblock a newly allocated structure

https://pagure.io/389-ds-base/issue/50709

Reviewed by: ?

If this now passes the paged results test (with ASAN) it gets my ack!

rebased onto 058f4da

4 years ago

Pull-Request has been merged by tbordaz

4 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3887

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago
Metadata