diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/format.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/format.c b/src/format.c index c5c7a1f..6bd7d58 100644 --- a/src/format.c +++ b/src/format.c @@ -2081,18 +2081,20 @@ format_expand(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, } static char * -format_format(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, +format_format(struct plugin_state *state, Slapi_Entry *e, const char *domain, const char *map, const char *fmt, const char *disallowed, struct format_choice **choices, char ***ref_attrs, struct format_inref_attr ***inref_attrs) { + Slapi_PBlock *pb; char *buf, *tmp, *ret, *spd_id; const char *match, *fmtstart, *fmtend; int i, buflen, exp_len; spd_id = state->plugin_desc->spd_id; buflen = DEFAULT_BUFFER_SIZE; + pb = slapi_pblock_new(); do { buf = malloc(buflen); if (buf == NULL) { @@ -2102,6 +2104,7 @@ format_format(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, "for \"%s\" failing: out of memory\n", fmt, slapi_entry_get_ndn(e)); + slapi_pblock_destroy(pb); return NULL; } @@ -2151,6 +2154,8 @@ format_format(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, free(buf); } while (i == -ENOBUFS); + slapi_pblock_destroy(pb); + return ret; } @@ -2161,15 +2166,8 @@ format_get_data(struct plugin_state *state, Slapi_Entry *e, char ***ref_attrs, struct format_inref_attr ***inref_attrs) { - Slapi_PBlock *pb; - char ***ndn_list, **local_ndn_list, *ret; - - pb = slapi_pblock_new(); - ret = format_format(state, pb, e, domain, map, fmt, disallowed, - NULL, ref_attrs, inref_attrs); - slapi_pblock_destroy(pb); - - return ret; + return format_format(state, e, domain, map, fmt, disallowed, + NULL, ref_attrs, inref_attrs); } char * |