summaryrefslogtreecommitdiff
path: root/server/util
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-06-04 13:37:10 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-06-08 11:35:06 -0400
commita9ca9d08ce562000b4aa155c54898763125eb7e3 (patch)
tree4ae4d8a600a2b5d718505da77c0f0e400e1fcf44 /server/util
parent23cc430238d6a0303e09bc00bd8c0c3f91f437da (diff)
downloadsssd-a9ca9d08ce562000b4aa155c54898763125eb7e3.tar.gz
sssd-a9ca9d08ce562000b4aa155c54898763125eb7e3.tar.bz2
sssd-a9ca9d08ce562000b4aa155c54898763125eb7e3.zip
Fix invalid pointer error in ldb_debug_messages
Diffstat (limited to 'server/util')
-rw-r--r--server/util/debug.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/server/util/debug.c b/server/util/debug.c
index f7f89f5c..d6a98e29 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);
}