diff options
author | Bart Polot <bart@net.in.tum.de> | 2012-10-10 18:54:34 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2012-10-10 18:54:34 +0000 |
commit | 2370b7bcd4649de55e06d86f16c35c360c93212b (patch) | |
tree | 0e1df50a614c72bdeb95a9b47a2f50557193a800 /src/mesh/gnunet-service-mesh.c | |
parent | 60574dc31dbb9419a29c9f1b1a7fca14c2bf712c (diff) | |
download | gnunet-2370b7bcd4649de55e06d86f16c35c360c93212b.tar.gz gnunet-2370b7bcd4649de55e06d86f16c35c360c93212b.zip |
- Mark queue entry as deleted before destroying
This is to avoid queue_destroy accessing that data structure and moving the entries around, which causes later entries to be avoided (jumped over) and causes crashes on core disconnect as queue_destroy accesses the then-invalid tunnel structure
Diffstat (limited to 'src/mesh/gnunet-service-mesh.c')
-rw-r--r-- | src/mesh/gnunet-service-mesh.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index fb1f7848d..327d638b5 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c | |||
@@ -3192,14 +3192,17 @@ tunnel_destroy_child (void *cls, | |||
3192 | { | 3192 | { |
3193 | struct MeshTunnelChildInfo *cinfo = value; | 3193 | struct MeshTunnelChildInfo *cinfo = value; |
3194 | struct MeshTunnel *t = cls; | 3194 | struct MeshTunnel *t = cls; |
3195 | struct MeshPeerQueue *q; | ||
3195 | unsigned int c; | 3196 | unsigned int c; |
3196 | unsigned int i; | 3197 | unsigned int i; |
3197 | 3198 | ||
3198 | for (c = 0; c < cinfo->send_buffer_n; c++) | 3199 | for (c = 0; c < cinfo->send_buffer_n; c++) |
3199 | { | 3200 | { |
3200 | i = (cinfo->send_buffer_start + c) % t->fwd_queue_max; | 3201 | i = (cinfo->send_buffer_start + c) % t->fwd_queue_max; |
3201 | if (NULL != cinfo->send_buffer[i]) | 3202 | q = cinfo->send_buffer[i]; |
3202 | queue_destroy (cinfo->send_buffer[i], GNUNET_YES); | 3203 | cinfo->send_buffer[i] = NULL; |
3204 | if (NULL != q) | ||
3205 | queue_destroy (q, GNUNET_YES); | ||
3203 | else | 3206 | else |
3204 | GNUNET_break (0); | 3207 | GNUNET_break (0); |
3205 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u %u\n", c, cinfo->send_buffer_n); | 3208 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "%u %u\n", c, cinfo->send_buffer_n); |