aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_publish.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-02-11 20:14:11 +0000
committerChristian Grothoff <christian@grothoff.org>2012-02-11 20:14:11 +0000
commit2315033adf26071ad64cef3e888c6df94f6139e4 (patch)
treef17e8447135f76a2a65a94fd981348e934899b6b /src/fs/fs_publish.c
parentea643e446372405a6ded9b482dc4481be32d8bfd (diff)
downloadgnunet-2315033adf26071ad64cef3e888c6df94f6139e4.tar.gz
gnunet-2315033adf26071ad64cef3e888c6df94f6139e4.zip
-generate PUBLISH_STOP event later to avoid use-after-free
Diffstat (limited to 'src/fs/fs_publish.c')
-rw-r--r--src/fs/fs_publish.c9
1 files 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)
1276 GNUNET_DATASTORE_cancel (pc->qre); 1276 GNUNET_DATASTORE_cancel (pc->qre);
1277 pc->qre = NULL; 1277 pc->qre = NULL;
1278 } 1278 }
1279 if (NULL != pc->dsh)
1280 {
1281 GNUNET_DATASTORE_disconnect (pc->dsh, GNUNET_NO);
1282 pc->dsh = NULL;
1283 }
1284 if (GNUNET_SCHEDULER_NO_TASK != pc->upload_task) 1279 if (GNUNET_SCHEDULER_NO_TASK != pc->upload_task)
1285 { 1280 {
1286 GNUNET_SCHEDULER_cancel (pc->upload_task); 1281 GNUNET_SCHEDULER_cancel (pc->upload_task);
@@ -1297,8 +1292,6 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc)
1297 pc->fi->serialization = NULL; 1292 pc->fi->serialization = NULL;
1298 } 1293 }
1299 off = (pc->fi->chk_uri == NULL) ? 0 : GNUNET_ntohll (pc->fi->chk_uri->data.chk.file_length); 1294 off = (pc->fi->chk_uri == NULL) ? 0 : GNUNET_ntohll (pc->fi->chk_uri->data.chk.file_length);
1300 pi.status = GNUNET_FS_STATUS_PUBLISH_STOPPED;
1301 GNUNET_break (NULL == GNUNET_FS_publish_make_status_ (&pi, pc, pc->fi, off));
1302 1295
1303 if (pc->serialization != NULL) 1296 if (pc->serialization != NULL)
1304 { 1297 {
@@ -1312,6 +1305,8 @@ GNUNET_FS_publish_stop (struct GNUNET_FS_PublishContext *pc)
1312 pc->in_network_wait = GNUNET_SYSERR; 1305 pc->in_network_wait = GNUNET_SYSERR;
1313 return; 1306 return;
1314 } 1307 }
1308 pi.status = GNUNET_FS_STATUS_PUBLISH_STOPPED;
1309 GNUNET_break (NULL == GNUNET_FS_publish_make_status_ (&pi, pc, pc->fi, off));
1315 publish_cleanup (pc, NULL); 1310 publish_cleanup (pc, NULL);
1316} 1311}
1317 1312