[Freeswitch-svn] [commit] r3013 - freeswitch/trunk/src/mod/endpoints/mod_sofia
Freeswitch SVN
mikej at freeswitch.org
Mon Oct 9 16:04:38 EDT 2006
Author: mikej
Date: Mon Oct 9 16:04:38 2006
New Revision: 3013
Modified:
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
Log:
fix checks in new logger function.
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Mon Oct 9 16:04:38 2006
@@ -1686,25 +1686,27 @@
static void logger(void *logarg, char const *fmt, va_list ap)
{
- char *data;
- int ret;
+ char *data = NULL;
if (fmt) {
#ifdef HAVE_VASPRINTF
+ int ret;
ret = vasprintf(&data, fmt, ap);
+ if ((ret == -1) || !data) {
+ return;
+ }
#else
data = (char *) malloc(2048);
- vsnprintf(data, 2048, fmt, ap);
-#endif
- if (ret == -1) {
+ if (data) {
+ vsnprintf(data, 2048, fmt, ap);
+ } else {
return;
}
+#endif
}
- if (data) {
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, (char*) "%s", data);
- free(data);
- }
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, (char*) "%s", data);
+ free(data);
}
More information about the Freeswitch-svn
mailing list