From 2315033adf26071ad64cef3e888c6df94f6139e4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 11 Feb 2012 20:14:11 +0000 Subject: [PATCH] -generate PUBLISH_STOP event later to avoid use-after-free --- src/fs/fs_publish.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index 3c5e87edb..444128016 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c @@ -1276,11 +1276,6 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc) GNUNET_DATASTORE_cancel (pc->qre); pc->qre = NULL; } - if (NULL != pc->dsh) - { - GNUNET_DATASTORE_disconnect (pc->dsh, GNUNET_NO); - pc->dsh = NULL; - } if (GNUNET_SCHEDULER_NO_TASK != pc->upload_task) { GNUNET_SCHEDULER_cancel (pc->upload_task); @@ -1297,8 +1292,6 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc) pc->fi->serialization = NULL; } off = (pc->fi->chk_uri == NULL) ? 0 : GNUNET_ntohll (pc->fi->chk_uri->data.chk.file_length); - pi.status = GNUNET_FS_STATUS_PUBLISH_STOPPED; - GNUNET_break (NULL == GNUNET_FS_publish_make_status_ (&pi, pc, pc->fi, off)); if (pc->serialization != NULL) { @@ -1312,6 +1305,8 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc) pc->in_network_wait = GNUNET_SYSERR; return; } + pi.status = GNUNET_FS_STATUS_PUBLISH_STOPPED; + GNUNET_break (NULL == GNUNET_FS_publish_make_status_ (&pi, pc, pc->fi, off)); publish_cleanup (pc, NULL); } -- 2.25.1