aboutsummaryrefslogtreecommitdiff
path: root/src/util/speedup.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-12-14 23:43:20 +0000
committerChristian Grothoff <christian@grothoff.org>2013-12-14 23:43:20 +0000
commit397d2a489f6af963ec63f8f5473469e46b7619f4 (patch)
treee88834f74b809be41c3d24a4b78f4bc2c2bfb631 /src/util/speedup.c
parentcc81eac80185a80edec6208fba6961cb392a53b8 (diff)
downloadgnunet-397d2a489f6af963ec63f8f5473469e46b7619f4.tar.gz
gnunet-397d2a489f6af963ec63f8f5473469e46b7619f4.zip
-fixing leaks on error paths
Diffstat (limited to 'src/util/speedup.c')
-rw-r--r--src/util/speedup.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/util/speedup.c b/src/util/speedup.c
index 52ac3287c..c038c3858 100644
--- a/src/util/speedup.c
+++ b/src/util/speedup.c
@@ -37,7 +37,8 @@ static GNUNET_SCHEDULER_TaskIdentifier speedup_task;
37 37
38 38
39static void 39static void
40do_speedup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) 40do_speedup (void *cls,
41 const struct GNUNET_SCHEDULER_TaskContext *tc)
41{ 42{
42 static long long current_offset; 43 static long long current_offset;
43 44
@@ -57,14 +58,18 @@ do_speedup (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
57 * Start task that may speed up our system clock artificially 58 * Start task that may speed up our system clock artificially
58 * 59 *
59 * @param cfg configuration to use 60 * @param cfg configuration to use
60 * @return GNUNET_OK on success, GNUNET_SYSERR if the speedup was not configured 61 * @return #GNUNET_OK on success, #GNUNET_SYSERR if the speedup was not configured
61 */ 62 */
62int 63int
63GNUNET_SPEEDUP_start_ (const struct GNUNET_CONFIGURATION_Handle *cfg) 64GNUNET_SPEEDUP_start_ (const struct GNUNET_CONFIGURATION_Handle *cfg)
64{ 65{
65 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "SPEEDUP_INTERVAL", &interval)) 66 if (GNUNET_OK !=
67 GNUNET_CONFIGURATION_get_value_time (cfg, "testing",
68 "SPEEDUP_INTERVAL", &interval))
66 return GNUNET_SYSERR; 69 return GNUNET_SYSERR;
67 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg, "testing", "SPEEDUP_DELTA", &delta)) 70 if (GNUNET_OK !=
71 GNUNET_CONFIGURATION_get_value_time (cfg, "testing",
72 "SPEEDUP_DELTA", &delta))
68 return GNUNET_SYSERR; 73 return GNUNET_SYSERR;
69 74
70 if ((0 == interval.rel_value_us) || (0 == delta.rel_value_us)) 75 if ((0 == interval.rel_value_us) || (0 == delta.rel_value_us))
@@ -79,7 +84,8 @@ GNUNET_SPEEDUP_start_ (const struct GNUNET_CONFIGURATION_Handle *cfg)
79 LOG (GNUNET_ERROR_TYPE_DEBUG, 84 LOG (GNUNET_ERROR_TYPE_DEBUG,
80 "Speed up executed every %s\n", 85 "Speed up executed every %s\n",
81 GNUNET_STRINGS_relative_time_to_string (interval, GNUNET_NO)); 86 GNUNET_STRINGS_relative_time_to_string (interval, GNUNET_NO));
82 speedup_task = GNUNET_SCHEDULER_add_now_with_lifeness (GNUNET_NO, &do_speedup, NULL); 87 speedup_task = GNUNET_SCHEDULER_add_now_with_lifeness (GNUNET_NO,
88 &do_speedup, NULL);
83 return GNUNET_OK; 89 return GNUNET_OK;
84} 90}
85 91
@@ -88,7 +94,7 @@ GNUNET_SPEEDUP_start_ (const struct GNUNET_CONFIGURATION_Handle *cfg)
88 * Stop tasks that modify clock behavior. 94 * Stop tasks that modify clock behavior.
89 */ 95 */
90void 96void
91GNUNET_SPEEDUP_stop_ ( ) 97GNUNET_SPEEDUP_stop_ ()
92{ 98{
93 if (GNUNET_SCHEDULER_NO_TASK != speedup_task) 99 if (GNUNET_SCHEDULER_NO_TASK != speedup_task)
94 { 100 {