summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ldb/common/ldb.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/ldb/common/ldb.c b/lib/ldb/common/ldb.c
index 3adc77ff85..2dd2d1bdde 100644
--- a/lib/ldb/common/ldb.c
+++ b/lib/ldb/common/ldb.c
@@ -269,28 +269,25 @@ int ldb_connect(struct ldb_context *ldb, const char *url,
void ldb_set_errstring(struct ldb_context *ldb, const char *err_string)
{
- if (ldb->err_string) {
- talloc_free(ldb->err_string);
- }
- ldb->err_string = talloc_strdup(ldb, err_string);
- if (ldb->flags & LDB_FLG_ENABLE_TRACING) {
- ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_set_errstring: %s", ldb->err_string);
- }
+ ldb_asprintf_errstring(ldb, "%s", err_string);
}
void ldb_asprintf_errstring(struct ldb_context *ldb, const char *format, ...)
{
va_list ap;
- char *old_string = NULL;
if (ldb->err_string) {
- old_string = ldb->err_string;
+ talloc_free(ldb->err_string);
}
va_start(ap, format);
ldb->err_string = talloc_vasprintf(ldb, format, ap);
va_end(ap);
- talloc_free(old_string);
+
+ if (ldb->flags & LDB_FLG_ENABLE_TRACING) {
+ ldb_debug(ldb, LDB_DEBUG_TRACE, "ldb_asprintf/set_errstring: %s",
+ ldb->err_string);
+ }
}
void ldb_reset_err_string(struct ldb_context *ldb)