... | ... |
@@ -28,7 +28,7 @@ NAME=ser |
28 | 28 |
# DEBUG compiles in some extra debugging code |
29 | 29 |
# OLD_PARSER uses the old and stable parser (from ser 8.3.2) |
30 | 30 |
# DNS_IP_HACK faster ip address resolver for ip strings (e.g "127.0.0.1") |
31 |
-DEFS=-DNOCR -DMACROEATER -DDNS_IP_HACK -DSTATS #-DNO_DEBUG#-DSTATS -DNO_DEBUG |
|
31 |
+DEFS=-DNOCR -DMACROEATER -DDNS_IP_HACK #-DNO_DEBUG#-DSTATS -DNO_DEBUG |
|
32 | 32 |
#-DNO_LOG |
33 | 33 |
|
34 | 34 |
PROFILE= # -pg #set this if you want profiling |
... | ... |
@@ -7,6 +7,7 @@ |
7 | 7 |
|
8 | 8 |
#ifndef mem_h |
9 | 9 |
#define mem_h |
10 |
+#include "dprint.h" |
|
10 | 11 |
|
11 | 12 |
#ifdef PKG_MALLOC |
12 | 13 |
#include "q_malloc.h" |
... | ... |
@@ -21,8 +22,11 @@ extern struct qm_block* mem_block; |
21 | 22 |
#else |
22 | 23 |
#include <stdlib.h> |
23 | 24 |
|
24 |
-#define pkg_malloc(s) malloc(s) |
|
25 |
-#define pkg_free(p) free(p) |
|
25 |
+#define pkg_malloc(s) \ |
|
26 |
+ ( { void *v; v=malloc(s); \ |
|
27 |
+ DBG("malloc %x size %d end %x\n", v, s, (unsigned int)v+s);\ |
|
28 |
+ v; } ) |
|
29 |
+#define pkg_free(p) do{ DBG("free %x\n", p); free(p); }while(0); |
|
26 | 30 |
#define pkg_status() |
27 | 31 |
|
28 | 32 |
#endif |
... | ... |
@@ -920,11 +920,11 @@ void free_hdr_field_lst(struct hdr_field* hf) |
920 | 920 |
void free_sip_msg(struct sip_msg* msg) |
921 | 921 |
{ |
922 | 922 |
if (msg->new_uri.s) { pkg_free(msg->new_uri.s); msg->new_uri.len=0; } |
923 |
- if (msg->headers) free_hdr_field_lst(msg->headers); |
|
923 |
+ if (msg->headers) free_hdr_field_lst(msg->headers); |
|
924 | 924 |
if (msg->add_rm) free_lump_list(msg->add_rm); |
925 | 925 |
if (msg->repl_add_rm) free_lump_list(msg->repl_add_rm); |
926 |
- free(msg->orig); |
|
927 |
- free(msg->buf); |
|
926 |
+ pkg_free(msg->orig); |
|
927 |
+ pkg_free(msg->buf); |
|
928 | 928 |
} |
929 | 929 |
|
930 | 930 |
|
... | ... |
@@ -154,12 +154,6 @@ int udp_rcv_loop() |
154 | 154 |
struct sockaddr* from; |
155 | 155 |
int fromlen; |
156 | 156 |
|
157 |
- buf=pkg_malloc(BUF_SIZE+1); |
|
158 |
- if (buf==0){ |
|
159 |
- LOG(L_ERR, "ERROR: udp_rcv_loop: could not allocate receive" |
|
160 |
- " buffer\n"); |
|
161 |
- goto error; |
|
162 |
- } |
|
163 | 157 |
from=(struct sockaddr*) malloc(sizeof(struct sockaddr)); |
164 | 158 |
if (from==0){ |
165 | 159 |
LOG(L_ERR, "ERROR: udp_rcv_loop: out of memory\n"); |
... | ... |
@@ -167,6 +161,12 @@ int udp_rcv_loop() |
167 | 161 |
} |
168 | 162 |
|
169 | 163 |
for(;;){ |
164 |
+ buf=pkg_malloc(BUF_SIZE+1); |
|
165 |
+ if (buf==0){ |
|
166 |
+ LOG(L_ERR, "ERROR: udp_rcv_loop: could not allocate receive" |
|
167 |
+ " buffer\n"); |
|
168 |
+ goto error; |
|
169 |
+ } |
|
170 | 170 |
fromlen=sizeof(struct sockaddr); |
171 | 171 |
len=recvfrom(udp_sock, buf, BUF_SIZE, 0, from, &fromlen); |
172 | 172 |
if (len==-1){ |