diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-12-05 02:13:36 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-12-05 02:13:36 +0000 |
commit | a74343f19917350ce2d8c80049fe2afb1f2f4809 (patch) | |
tree | be17bd83e894d459afe87d84ec1f32c421a3529e /src | |
parent | 0a502ae54a23ffa66c0a3744e74192e25709b250 (diff) | |
download | gnunet-a74343f19917350ce2d8c80049fe2afb1f2f4809.tar.gz gnunet-a74343f19917350ce2d8c80049fe2afb1f2f4809.zip |
- avoid dereferencing copy after channel (and therefore copy) was destroyed
Diffstat (limited to 'src')
-rw-r--r-- | src/mesh/gnunet-service-mesh_channel.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/mesh/gnunet-service-mesh_channel.c b/src/mesh/gnunet-service-mesh_channel.c index 07bb4007b..420e207b3 100644 --- a/src/mesh/gnunet-service-mesh_channel.c +++ b/src/mesh/gnunet-service-mesh_channel.c | |||
@@ -922,7 +922,7 @@ channel_rel_free_all (struct MeshChannelReliability *rel) | |||
922 | { | 922 | { |
923 | GNUNET_SCHEDULER_cancel (rel->retry_task); | 923 | GNUNET_SCHEDULER_cancel (rel->retry_task); |
924 | } | 924 | } |
925 | if (NULL != rel->uniq) | 925 | if (NULL != rel->uniq && NULL != rel->uniq->q) |
926 | GMT_cancel (rel->uniq->q); | 926 | GMT_cancel (rel->uniq->q); |
927 | GNUNET_free (rel); | 927 | GNUNET_free (rel); |
928 | } | 928 | } |
@@ -1041,19 +1041,21 @@ rel_message_free (struct MeshReliableMessage *copy, int update_time) | |||
1041 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! batch free, ignoring timing\n"); | 1041 | LOG (GNUNET_ERROR_TYPE_DEBUG, "!!! batch free, ignoring timing\n"); |
1042 | } | 1042 | } |
1043 | rel->ch->pending_messages--; | 1043 | rel->ch->pending_messages--; |
1044 | if (GNUNET_NO != rel->ch->destroy && 0 == rel->ch->pending_messages) | ||
1045 | { | ||
1046 | struct MeshTunnel3 *t = rel->ch->t; | ||
1047 | GMCH_destroy (rel->ch); | ||
1048 | GMT_destroy_if_empty (t); | ||
1049 | } | ||
1050 | if (NULL != copy->q) | 1044 | if (NULL != copy->q) |
1051 | { | 1045 | { |
1052 | GMT_cancel (copy->q->q); | 1046 | GMT_cancel (copy->q->q); |
1047 | /* copy->q is set to NULL by ch_message_sent */ | ||
1053 | } | 1048 | } |
1054 | GNUNET_CONTAINER_DLL_remove (rel->head_sent, rel->tail_sent, copy); | 1049 | GNUNET_CONTAINER_DLL_remove (rel->head_sent, rel->tail_sent, copy); |
1055 | LOG (GNUNET_ERROR_TYPE_DEBUG, " COPYFREE %p\n", copy); | 1050 | LOG (GNUNET_ERROR_TYPE_DEBUG, " COPYFREE %p\n", copy); |
1056 | GNUNET_free (copy); | 1051 | GNUNET_free (copy); |
1052 | |||
1053 | if (GNUNET_NO != rel->ch->destroy && 0 == rel->ch->pending_messages) | ||
1054 | { | ||
1055 | struct MeshTunnel3 *t = rel->ch->t; | ||
1056 | GMCH_destroy (rel->ch); | ||
1057 | GMT_destroy_if_empty (t); | ||
1058 | } | ||
1057 | } | 1059 | } |
1058 | 1060 | ||
1059 | 1061 | ||