From 9743d79ec585494febdd2029b9094e948f09ac67 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Wed, 11 Jan 2012 17:55:18 -0500 Subject: - don't use the deprecated slapi_dn_parent() function, the result of which we used to leak --- src/format.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/format.c b/src/format.c index 5df48d2..9f5b214 100644 --- a/src/format.c +++ b/src/format.c @@ -1214,7 +1214,7 @@ format_deref_rx(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, { int i, j, k, argc; Slapi_Entry *entry; - Slapi_DN **these, **these2, **next, **next2; + Slapi_DN **these, **these2, **next, **next2, *parent; Slapi_ValueSet *values; Slapi_Value *value; int disposition, buffer_flags; @@ -1243,6 +1243,7 @@ format_deref_rx(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, choices = NULL; dn = slapi_entry_get_dn(e); format_add_sdn_list(&these, &these2, dn); + parent = slapi_sdn_new(); /* For the first N-1 links, read the contents of the named attribute * from each entry we're examining at this point, and use the values @@ -1259,14 +1260,16 @@ format_deref_rx(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, /* For heuristic use later, note the parent of the * entry from which we're reading this attribute. */ dn = slapi_sdn_get_ndn(these[j]); + slapi_sdn_get_parent(these[j], parent); slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, "%s: noting parent " "\"%s\" for \"%s\"\n", - fname, slapi_dn_parent(dn), attrs[0]); + fname, slapi_sdn_get_ndn(parent), + attrs[0]); format_add_sdn_list(&list->links[i].base_sdn_list, &list->links[i].base_sdn_list2, - slapi_dn_parent(dn)); + slapi_sdn_get_ndn(parent)); /* Pull up the named entry. */ wrap_search_internal_get_entry(these[j], NULL, @@ -1354,6 +1357,7 @@ format_deref_rx(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, } /* Clean up and return any values we found. */ + slapi_sdn_free(&parent); format_free_sdn_list(these, these2); if (choices != NULL) { format_add_choice(outbuf_choices, outbuf, &choices); -- cgit