[Asterisk-Users] small fix in chan_mgcp.c

Roy Sigurd Karlsbakk roy at karlsbakk.net
Mon Aug 4 04:11:06 MST 2003


there was a tiny memory leak in chan_mgcp.c
there's still lots of memory leaks AFACS, and I'm tracking on.

Still - I can't find the memory allocation routine allocating 2MB each time I 
lift the handset of my mgcp phone ...

roy

diff -u -r1.16 chan_mgcp.c
--- channels/chan_mgcp.c        2 Aug 2003 05:46:32 -0000       1.16
+++ channels/chan_mgcp.c        4 Aug 2003 11:30:34 -0000
@@ -1261,7 +1261,10 @@
         sdpLineNum_iterator_init(&iterator);
         while ((a = get_sdp_iterate(&iterator, req, "a"))[0] != '\0') {
           char* mimeSubtype = strdup(a); // ensures we have enough space
-          if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2) 
continue;
+          if (sscanf(a, "rtpmap: %u %[^/]/", &codec, mimeSubtype) != 2) {
+                 free(mimeSubtype);
+                 continue;
+         }
           // Note: should really look at the 'freq' and '#chans' params too
           ast_rtp_set_rtpmap_type(sub->rtp, codec, "audio", mimeSubtype);
          free(mimeSubtype);

-- 
Roy Sigurd Karlsbakk, Datavaktmester
ProntoTV AS - http://www.pronto.tv/
Tel: +47 2254 5070 (work)
     +47 9801 3356 (mobile)

Computers are like air conditioners.
They stop working when you open Windows.




More information about the asterisk-users mailing list