Browse Source

dtmf: prevent freeing json buf too early

When both logging and sending the DTMF event further, the json buffer
was released/freed _before_ being sent on the network, resulting in a
0-length UDP packet. On the other hand, if only UDP sending was used
(without logging), a leak was happening. This commit fixes both issues.
pull/797/head
Razvan Crainea 7 years ago
parent
commit
8fb603e5c3
2 changed files with 1 additions and 1 deletions
  1. +1
    -0
      daemon/dtmf.c
  2. +0
    -1
      daemon/log.c

+ 1
- 0
daemon/dtmf.c View File

@ -82,6 +82,7 @@ int dtmf_event(struct media_packet *mp, str *payload, int clockrate) {
dtmflog(buf);
if (dtmf_log_sock.family)
send(dtmf_log_sock.fd, buf->str, buf->len, 0);
g_string_free(buf, TRUE);
ret = 1; // END event
}


+ 0
- 1
daemon/log.c View File

@ -125,7 +125,6 @@ void dtmflog(GString *s) {
if (_log_facility_dtmf) {
syslog(LOG_INFO | _log_facility_dtmf, "%s", s->str);
}
g_string_free(s, TRUE);
}


Loading…
Cancel
Save