diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-11-17 13:07:41 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-11-17 13:07:41 +0000 |
commit | 51977773c39d5034eb12b29be03e1ed42176b8e5 (patch) | |
tree | 3c9c3e0c8078dca08a82b2722d934dec91833e49 /src/nat/nat_stun.c | |
parent | 45a5959e0880e2ac07fac765ba0284ef45414f91 (diff) | |
download | gnunet-51977773c39d5034eb12b29be03e1ed42176b8e5.tar.gz gnunet-51977773c39d5034eb12b29be03e1ed42176b8e5.zip |
-fixing memory leaks and shutdown issues related to NAT
Diffstat (limited to 'src/nat/nat_stun.c')
-rw-r--r-- | src/nat/nat_stun.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/nat/nat_stun.c b/src/nat/nat_stun.c index e97b0016b..ee5ded8ef 100644 --- a/src/nat/nat_stun.c +++ b/src/nat/nat_stun.c | |||
@@ -322,8 +322,8 @@ stun_get_mapped (struct StunState *st, | |||
322 | * If a callback is specified, invoke it with the attribute. | 322 | * If a callback is specified, invoke it with the attribute. |
323 | * | 323 | * |
324 | * @param data the packet | 324 | * @param data the packet |
325 | * @param len the length of the packet | 325 | * @param len the length of the packet in @a data |
326 | * @param arg sockaddr_in where we will set our discovered packet | 326 | * @param[out] arg sockaddr_in where we will set our discovered address |
327 | * | 327 | * |
328 | * @return, #GNUNET_OK on OK, #GNUNET_NO if the packet is invalid (not a stun packet) | 328 | * @return, #GNUNET_OK on OK, #GNUNET_NO if the packet is invalid (not a stun packet) |
329 | */ | 329 | */ |
@@ -361,7 +361,7 @@ GNUNET_NAT_stun_handle_packet (const void *data, | |||
361 | 361 | ||
362 | message_magic_cookie = ntohl(hdr->magic); | 362 | message_magic_cookie = ntohl(hdr->magic); |
363 | /* Compare if the cookie match */ | 363 | /* Compare if the cookie match */ |
364 | if(STUN_MAGIC_COOKIE != message_magic_cookie) | 364 | if (STUN_MAGIC_COOKIE != message_magic_cookie) |
365 | { | 365 | { |
366 | LOG (GNUNET_ERROR_TYPE_INFO, | 366 | LOG (GNUNET_ERROR_TYPE_INFO, |
367 | "Invalid magic cookie \n"); | 367 | "Invalid magic cookie \n"); |
@@ -382,7 +382,7 @@ GNUNET_NAT_stun_handle_packet (const void *data, | |||
382 | return GNUNET_NO; | 382 | return GNUNET_NO; |
383 | } | 383 | } |
384 | len = advertised_message_size; | 384 | len = advertised_message_size; |
385 | memset (&st,0, sizeof(st)); | 385 | memset (&st, 0, sizeof(st)); |
386 | 386 | ||
387 | while (len > 0) | 387 | while (len > 0) |
388 | { | 388 | { |
@@ -408,7 +408,10 @@ GNUNET_NAT_stun_handle_packet (const void *data, | |||
408 | (int)len); | 408 | (int)len); |
409 | break; | 409 | break; |
410 | } | 410 | } |
411 | stun_get_mapped (&st, attr, arg, hdr->magic); | 411 | stun_get_mapped (&st, |
412 | attr, | ||
413 | arg, | ||
414 | hdr->magic); | ||
412 | /* Clear attribute id: in case previous entry was a string, | 415 | /* Clear attribute id: in case previous entry was a string, |
413 | * this will act as the terminator for the string. | 416 | * this will act as the terminator for the string. |
414 | */ | 417 | */ |
@@ -508,6 +511,7 @@ stun_dns_callback (void *cls, | |||
508 | /* sending STUN request done, let's wait for replies... */ | 511 | /* sending STUN request done, let's wait for replies... */ |
509 | rh->cb (rh->cb_cls, | 512 | rh->cb (rh->cb_cls, |
510 | GNUNET_NAT_ERROR_SUCCESS); | 513 | GNUNET_NAT_ERROR_SUCCESS); |
514 | GNUNET_NAT_stun_make_request_cancel (rh); | ||
511 | } | 515 | } |
512 | 516 | ||
513 | 517 | ||