Skip to content

Commit

Permalink
Merge pull request #3189 from Keyyo-Private/fix_ldap_memleak
Browse files Browse the repository at this point in the history
ldap: Fix memory leak
  • Loading branch information
bogdan-iancu committed Sep 26, 2023
2 parents 7bafee1 + 4612a7f commit d82ddd8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/ldap/ldap_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ static int child_init(int rank);
*/
static int fixup_result_avp_type(void **param);
static int fixup_substre(void** param);
static int fixup_free_substre(void** param);

/*
* exported functions
Expand Down Expand Up @@ -102,7 +103,7 @@ static const cmd_export_t cmds[] = {
{CMD_PARAM_STR, 0, 0},
{CMD_PARAM_VAR, 0, 0},
{CMD_PARAM_STR | CMD_PARAM_OPT, fixup_result_avp_type, 0},
{CMD_PARAM_STR | CMD_PARAM_OPT, fixup_substre, 0}, {0,0,0}},
{CMD_PARAM_STR | CMD_PARAM_OPT, fixup_substre, fixup_free_substre}, {0,0,0}},
REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|
ONREPLY_ROUTE|LOCAL_ROUTE|STARTUP_ROUTE|TIMER_ROUTE|EVENT_ROUTE},
{"ldap_result_next", (cmd_function)w_ldap_result_next, {{0,0,0}},
Expand All @@ -111,7 +112,7 @@ static const cmd_export_t cmds[] = {
{"ldap_result_check", (cmd_function)w_ldap_result_check, {
{CMD_PARAM_STR, 0, 0},
{CMD_PARAM_STR, 0, 0},
{CMD_PARAM_STR | CMD_PARAM_OPT, fixup_substre, 0}, {0,0,0}},
{CMD_PARAM_STR | CMD_PARAM_OPT, fixup_substre, fixup_free_substre}, {0,0,0}},
REQUEST_ROUTE|FAILURE_ROUTE|
BRANCH_ROUTE|ONREPLY_ROUTE|LOCAL_ROUTE|STARTUP_ROUTE|TIMER_ROUTE|EVENT_ROUTE},
{"ldap_filter_url_encode", (cmd_function)w_ldap_filter_url_encode, {
Expand Down Expand Up @@ -344,3 +345,9 @@ static int fixup_substre(void** param)
*param=se;
return 0;
}

static int fixup_free_substre(void** param)
{
subst_expr_free(*param);
return 0;
}

0 comments on commit d82ddd8

Please sign in to comment.