298ea67a65
- also add a patch that fixes debugging output (potential segfault)
59 lines
1.4 KiB
Diff
59 lines
1.4 KiB
Diff
From 832ef83184b1d67b7006becf149f1f8fce580ec3 Mon Sep 17 00:00:00 2001
|
|
From: Stephen Gallagher <sgallagh@redhat.com>
|
|
Date: Thu, 4 Jun 2009 13:37:10 -0400
|
|
Subject: [PATCH] Fix invalid pointer error in ldb_debug_messages
|
|
|
|
---
|
|
server/util/debug.c | 21 +++++++++++++++++++--
|
|
1 files changed, 19 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/server/util/debug.c b/server/util/debug.c
|
|
index f7f89f5..d6a98e2 100644
|
|
--- a/server/util/debug.c
|
|
+++ b/server/util/debug.c
|
|
@@ -12,9 +12,16 @@ void debug_fn(const char *format, ...)
|
|
{
|
|
va_list ap;
|
|
char *s = NULL;
|
|
+ int ret;
|
|
|
|
va_start(ap, format);
|
|
- vasprintf(&s, format, ap);
|
|
+
|
|
+ ret = vasprintf(&s, format, ap);
|
|
+ if (ret < 0) {
|
|
+ /* ENOMEM */
|
|
+ return;
|
|
+ }
|
|
+
|
|
va_end(ap);
|
|
|
|
/*write(state.fd, s, strlen(s));*/
|
|
@@ -26,6 +33,9 @@ void ldb_debug_messages(void *context, enum ldb_debug_level level,
|
|
const char *fmt, va_list ap)
|
|
{
|
|
int loglevel = -1;
|
|
+ int ret;
|
|
+ char * message = NULL;
|
|
+
|
|
switch(level) {
|
|
case LDB_DEBUG_FATAL:
|
|
loglevel = 0;
|
|
@@ -41,5 +51,12 @@ void ldb_debug_messages(void *context, enum ldb_debug_level level,
|
|
break;
|
|
}
|
|
|
|
- DEBUG(loglevel, (fmt, ap));
|
|
+ ret = vasprintf(&message, fmt, ap);
|
|
+ if (ret < 0) {
|
|
+ /* ENOMEM */
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ DEBUG(loglevel, (message));
|
|
+ free(message);
|
|
}
|
|
--
|
|
1.6.2.2
|
|
|