summaryrefslogtreecommitdiffstats
path: root/src/format.c
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@dahyabhai.net>2012-01-11 17:55:18 -0500
committerNalin Dahyabhai <nalin@dahyabhai.net>2012-01-11 17:55:18 -0500
commit9743d79ec585494febdd2029b9094e948f09ac67 (patch)
tree5a0455fbbb7f86e5f6fdfd32648d7c5cebb4b2c2 /src/format.c
parent3c053e1843e14d638926e0e73dc8818ca86e9ecb (diff)
downloadslapi-nis-9743d79ec585494febdd2029b9094e948f09ac67.tar.gz
slapi-nis-9743d79ec585494febdd2029b9094e948f09ac67.tar.xz
slapi-nis-9743d79ec585494febdd2029b9094e948f09ac67.zip
- don't use the deprecated slapi_dn_parent() function, the result of which we used to leak
Diffstat (limited to 'src/format.c')
-rw-r--r--src/format.c10
1 files 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);