diff options
Diffstat (limited to 'source4/lib/ldb/common/ldb.c')
-rw-r--r-- | source4/lib/ldb/common/ldb.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 25d273f8e9..f687e152d3 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -277,14 +277,16 @@ void ldb_set_errstring(struct ldb_context *ldb, const char *err_string) void ldb_asprintf_errstring(struct ldb_context *ldb, const char *format, ...) { va_list ap; + char *old_string = NULL; if (ldb->err_string) { - talloc_free(ldb->err_string); + old_string = ldb->err_string; } va_start(ap, format); ldb->err_string = talloc_vasprintf(ldb, format, ap); va_end(ap); + talloc_free(old_string); } void ldb_reset_err_string(struct ldb_context *ldb) |