commit fbfa7f809cf260a1b1ce9c1a02fdb79fe9aa6f7b
parent 5f012e7bccf32d9a3bb9d59cdd0a86fadd2ec66c
Author: Bart Polot <bart@net.in.tum.de>
Date: Thu, 10 Apr 2014 09:19:06 +0000
- fix use after free
Diffstat:
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/mesh/gnunet-service-mesh_connection.c b/src/mesh/gnunet-service-mesh_connection.c
@@ -579,15 +579,18 @@ message_sent (void *cls,
struct MeshConnectionQueue *q = cls;
double usecsperbyte;
int forced;
+ uint32_t pid;
LOG (GNUNET_ERROR_TYPE_DEBUG, "connection message_sent\n");
fc = fwd ? &c->fwd_fc : &c->bck_fc;
+ pid = 0;
LOG (GNUNET_ERROR_TYPE_DEBUG, " %ssent %s %s\n",
sent ? "" : "not ", GM_f2s (fwd), GM_m2s (type));
LOG (GNUNET_ERROR_TYPE_DEBUG, " C_P- %p %u\n", c, c->pending_messages);
if (NULL != q)
{
+ pid = q->pid;
forced = q->forced;
if (NULL != q->cont)
{
@@ -625,7 +628,10 @@ message_sent (void *cls,
case GNUNET_MESSAGE_TYPE_MESH_ENCRYPTED:
if (GNUNET_YES == sent)
- fc->last_pid_sent = q->pid;
+ {
+ GNUNET_assert (NULL != q);
+ fc->last_pid_sent = pid;
+ }
LOG (GNUNET_ERROR_TYPE_DEBUG, "! Q_N- %p %u\n", fc, fc->queue_n);
if (GNUNET_NO == forced)