From: Bart Polot Date: Tue, 8 May 2012 19:02:31 +0000 (+0000) Subject: - fixed more memory leaks, doc, refactor X-Git-Tag: initial-import-from-subversion-38251~13591 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=34aadf488e4b4abcd0d569c669dda32d38edebd6;p=oweals%2Fgnunet.git - fixed more memory leaks, doc, refactor --- diff --git a/src/testing/testing.c b/src/testing/testing.c index ffff2ad58..c9080f444 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c @@ -694,8 +694,8 @@ start_fsm (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) GNUNET_free_non_null (d->hostname); GNUNET_free_non_null (d->username); GNUNET_free_non_null (d->shortname); - // GNUNET_free_non_null (d->proc); // !? FIXME - // d->proc_arm_stop = NULL; + GNUNET_OS_process_destroy (d->proc_arm_stop); + d->proc_arm_stop = NULL; GNUNET_free (d); return; } @@ -1475,9 +1475,10 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, kill_and_close_process (d->proc_arm_peerinfo); d->proc_arm_peerinfo = NULL; } - if ((d->running == GNUNET_NO) && (d->churn == GNUNET_YES)) /* Peer has already been stopped in churn context! */ + if ((d->running == GNUNET_NO) && (d->churn == GNUNET_YES)) { - /* Free what was left from churning! */ + /* Peer has already been stopped in churn context! + * Free what was left from churning! */ GNUNET_assert (d->cfg != NULL); GNUNET_CONFIGURATION_destroy (d->cfg); if (delete_files == GNUNET_YES) diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index d8e969461..666759dba 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c @@ -2911,7 +2911,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg) GNUNET_OS_start_process (GNUNET_NO, NULL, NULL, "scp", "scp", mytemp, arg, NULL); GNUNET_assert (procarr[pg_iter] != NULL); ret = GNUNET_OS_process_wait (procarr[pg_iter]); /* FIXME: schedule this, throttle! */ - GNUNET_OS_process_destroy (procarr[pg_iter]); + GNUNET_OS_process_close (procarr[pg_iter]); if (ret != GNUNET_OK) { /* FIXME: free contents of 'procarr' array */ @@ -2953,7 +2953,7 @@ create_and_copy_friend_files (struct GNUNET_TESTING_PeerGroup *pg) } else { - GNUNET_OS_process_destroy (procarr[pg_iter]); + GNUNET_OS_process_close (procarr[pg_iter]); procarr[pg_iter] = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "File %d copied\n", pg_iter); } @@ -3128,7 +3128,7 @@ create_and_copy_blacklist_files (struct GNUNET_TESTING_PeerGroup *pg, } else { - GNUNET_OS_process_destroy (procarr[pg_iter]); + GNUNET_OS_process_close (procarr[pg_iter]); procarr[pg_iter] = NULL; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "File %d copied\n", pg_iter); } @@ -5672,7 +5672,7 @@ check_peers_started (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } } - GNUNET_OS_process_destroy (helper->proc); + GNUNET_OS_process_close (helper->proc); } static void @@ -5935,7 +5935,7 @@ GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_free (tmpdir); GNUNET_free (arg); GNUNET_OS_process_wait (proc); - GNUNET_OS_process_destroy (proc); + GNUNET_OS_process_close (proc); } GNUNET_free (baseservicehome); baseservicehome = NULL; @@ -6161,7 +6161,7 @@ GNUNET_TESTING_daemons_start (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_assert (0); } GNUNET_OS_process_wait (proc); - GNUNET_OS_process_destroy (proc); + GNUNET_OS_process_close (proc); } /* Now all the configuration files and hostkeys are copied to the remote host. Call the hostkey callback for each peer! */ GNUNET_SCHEDULER_add_now (&call_hostkey_callbacks, pg); @@ -6810,22 +6810,24 @@ schedule_shutdown_task (void *cls, { struct PeerShutdownContext *peer_shutdown_ctx = cls; struct ShutdownContext *shutdown_ctx; + struct GNUNET_TESTING_Daemon *d; GNUNET_assert (peer_shutdown_ctx != NULL); + d = peer_shutdown_ctx->daemon; shutdown_ctx = peer_shutdown_ctx->shutdown_ctx; GNUNET_assert (shutdown_ctx != NULL); if ((shutdown_ctx->outstanding < shutdown_ctx->pg->max_concurrent_ssh) || - ((peer_shutdown_ctx->daemon->hostname != NULL) && + ((d->hostname != NULL) && (count_outstanding_at_host - (peer_shutdown_ctx->daemon->hostname, + (d->hostname, shutdown_ctx->pg) < shutdown_ctx->pg->max_concurrent_ssh))) { - if (peer_shutdown_ctx->daemon->hostname != NULL) - increment_outstanding_at_host (peer_shutdown_ctx->daemon->hostname, + if (d->hostname != NULL) + increment_outstanding_at_host (d->hostname, shutdown_ctx->pg); shutdown_ctx->outstanding++; - GNUNET_TESTING_daemon_stop (peer_shutdown_ctx->daemon, + GNUNET_TESTING_daemon_stop (d, shutdown_ctx->timeout, &internal_shutdown_callback, peer_shutdown_ctx, shutdown_ctx->delete_files, GNUNET_NO);