diff options
| author | Nalin Dahyabhai <nalin@redhat.com> | 2011-07-26 13:46:01 -0400 |
|---|---|---|
| committer | Nalin Dahyabhai <nalin@redhat.com> | 2011-07-26 13:46:01 -0400 |
| commit | 0eb39062b1d44745cc1d0f1ded5a6a5e8ed4ddc6 (patch) | |
| tree | 9e3e26ac65da3c22ac9a3ce8e19db84982ec9e64 /src | |
| parent | 260cbd12471639197dd87b5fc613613745ffd0ab (diff) | |
- don't dup a list and then just free the original
Diffstat (limited to 'src')
| -rw-r--r-- | src/format.c | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/format.c b/src/format.c index 75d6db2..598fbce 100644 --- a/src/format.c +++ b/src/format.c @@ -762,7 +762,7 @@ format_append_choice(struct format_choice **choices, } static void format_add_choice(struct format_choice **choices, char *offset, - struct berval **values) + struct berval ***values) { struct format_choice *choice; int i; @@ -775,7 +775,8 @@ format_add_choice(struct format_choice **choices, char *offset, continue; } choice->n_values = i; - choice->values = format_dup_bv_list(values); + choice->values = *values; + *values = NULL; if (choice->values != NULL) { format_append_choice(choices, choice); } else { @@ -820,8 +821,7 @@ format_add_choice_str(struct format_choice **choices, char *offset, { struct berval **vals; vals = format_strlist_to_bv_list(values); - format_add_choice(choices, offset, vals); - format_free_bv_list(vals); + format_add_choice(choices, offset, &vals); } /* Parse an argument string into an array of arguments. */ @@ -1070,8 +1070,7 @@ format_deref_x(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, ref_buffer_flags); /* Return any values we found. */ if (choices != NULL) { - format_add_choice(outbuf_choices, outbuf, choices); - format_free_bv_list(choices); + format_add_choice(outbuf_choices, outbuf, &choices); return 0; } else { return -ENOENT; @@ -1311,8 +1310,7 @@ format_deref_rx(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, /* Clean up and return any values we found. */ format_free_sdn_list(these); if (choices != NULL) { - format_add_choice(outbuf_choices, outbuf, choices); - format_free_bv_list(choices); + format_add_choice(outbuf_choices, outbuf, &choices); return 0; } else { return -ENOENT; @@ -1616,8 +1614,7 @@ format_referred(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, /* Return any values we found. */ if (cbdata.choices != NULL) { - format_add_choice(outbuf_choices, outbuf, cbdata.choices); - format_free_bv_list(cbdata.choices); + format_add_choice(outbuf_choices, outbuf, &cbdata.choices); return 0; } else { return -ENOENT; @@ -1913,8 +1910,7 @@ format_referred_r(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, /* Return any values we found. */ if (choices != NULL) { - format_add_choice(outbuf_choices, outbuf, choices); - format_free_bv_list(choices); + format_add_choice(outbuf_choices, outbuf, &choices); return 0; } else { return -ENOENT; @@ -2550,8 +2546,7 @@ format_collect(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, state->plugin_desc->spd_id, "collect: returning %d values for \"%s\"\n", i, slapi_entry_get_dn(e)); - format_add_choice(outbuf_choices, outbuf, choices); - format_free_bv_list(choices); + format_add_choice(outbuf_choices, outbuf, &choices); ret = 0; } else { ret = -ENOENT; @@ -2735,8 +2730,7 @@ format_link(struct plugin_state *state, Slapi_PBlock *pb, Slapi_Entry *e, } if (choices != NULL) { - format_add_choice(outbuf_choices, outbuf, choices); - format_free_bv_list(choices); + format_add_choice(outbuf_choices, outbuf, &choices); ret = 0; } else { ret = -ENOENT; @@ -3235,9 +3229,8 @@ format_expand_simple(struct plugin_state *state, * be fine at this point in the output string. * */ format_add_choice(outbuf_choices, - outbuf, values); + outbuf, &values); free(expr); - format_free_bv_list(values); return 0; } } |
