From 2fe39a82bf3fcd7d9c214151bfaa570f617630f0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 22 Aug 2006 22:28:37 +0000 Subject: [PATCH] r17722: better to use talloc_vasprintf() than vasprintf() directly, as it depends on less libc functions (This used to be commit a05101d83b06543cd32b08b4dec29d8f6bd27674) --- source4/lib/ldb/common/ldb_dn.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/source4/lib/ldb/common/ldb_dn.c b/source4/lib/ldb/common/ldb_dn.c index 7dfcba0631f..a0f48723ab9 100644 --- a/source4/lib/ldb/common/ldb_dn.c +++ b/source4/lib/ldb/common/ldb_dn.c @@ -836,19 +836,18 @@ struct ldb_dn *ldb_dn_string_compose(void *mem_ctx, const struct ldb_dn *base, c struct ldb_dn *dn; char *child_str; va_list ap; - int ret; if (child_fmt == NULL) return NULL; va_start(ap, child_fmt); - ret = vasprintf(&child_str, child_fmt, ap); + child_str = talloc_vasprintf(mem_ctx, child_fmt, ap); va_end(ap); - if (ret <= 0) return NULL; + if (child_str == NULL) return NULL; dn = ldb_dn_compose(mem_ctx, ldb_dn_explode(mem_ctx, child_str), base); - free(child_str); + talloc_free(child_str); return dn; }