summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--agent/conncheck.c11
-rw-r--r--stun/utils.c17
-rw-r--r--stun/utils.h3
3 files changed, 27 insertions, 4 deletions
diff --git a/agent/conncheck.c b/agent/conncheck.c
index d93af40..2fe3bd4 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -1199,6 +1199,10 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
agent->tie_breaker,
priv_agent_to_usage_compatibility (agent));
+ if (agent->compatibility == NICE_COMPATIBILITY_MSN) {
+ g_free (password);
+ }
+
stun_timer_start (&pair->timer);
/* send the conncheck */
@@ -1787,6 +1791,9 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
valid = stun_agent_validate (&agent->stun_agent, &req, (uint8_t *) buf, len,
stun_agent_default_validater, validater_data);
+ if (agent->compatibility == NICE_COMPATIBILITY_MSN) {
+ g_free (validater_data[0].password);
+ }
if (valid == STUN_VALIDATION_NOT_STUN ||
valid == STUN_VALIDATION_INCOMPLETE_STUN ||
@@ -1885,6 +1892,10 @@ gboolean conn_check_handle_inbound_stun (NiceAgent *agent, Stream *stream,
&control, agent->tie_breaker,
priv_agent_to_usage_compatibility (agent));
+ if (agent->compatibility == NICE_COMPATIBILITY_MSN) {
+ g_free (req.key);
+ }
+
if (res == EACCES)
priv_check_for_role_conflict (agent, control);
diff --git a/stun/utils.c b/stun/utils.c
index 945c3c5..c024986 100644
--- a/stun/utils.c
+++ b/stun/utils.c
@@ -131,12 +131,23 @@ uint16_t stun_getw (const uint8_t *ptr)
/* return stun_find_unknown (msg, &dummy, 1); */
/* } */
+static int debug_enabled = 0;
+
+void stun_debug_enable (void) {
+ debug_enabled = 1;
+}
+void stun_debug_disable (void) {
+ debug_enabled = 0;
+}
+
void stun_debug (const char *fmt, ...)
{
va_list ap;
- va_start (ap, fmt);
- vfprintf (stderr, fmt, ap);
- va_end (ap);
+ if (debug_enabled) {
+ va_start (ap, fmt);
+ vfprintf (stderr, fmt, ap);
+ va_end (ap);
+ }
}
void stun_debug_bytes (const void *data, size_t len)
diff --git a/stun/utils.h b/stun/utils.h
index 6cd36bf..358c448 100644
--- a/stun/utils.h
+++ b/stun/utils.h
@@ -58,8 +58,9 @@ size_t stun_align (size_t l);
uint16_t stun_getw (const uint8_t *ptr);
+void stun_debug_enable (void);
+void stun_debug_disable (void);
void stun_debug (const char *fmt, ...);
-
void stun_debug_bytes (const void *data, size_t len);
int stun_xor_address (const StunMessage *msg,