diff options
author | Sree Harsha Totakura <totakura@in.tum.de> | 2012-09-14 20:42:30 +0000 |
---|---|---|
committer | Sree Harsha Totakura <totakura@in.tum.de> | 2012-09-14 20:42:30 +0000 |
commit | ce1537de07f093ffcc3bccf3a444f7dfd9784181 (patch) | |
tree | 5c4bdc000ac74261df2721b93785aade25f67127 /src/testbed | |
parent | 52120245ff42d584ef05df14a911742f8aad2ac4 (diff) | |
download | gnunet-ce1537de07f093ffcc3bccf3a444f7dfd9784181.tar.gz gnunet-ce1537de07f093ffcc3bccf3a444f7dfd9784181.zip |
coverity fixes
Diffstat (limited to 'src/testbed')
-rw-r--r-- | src/testbed/gnunet-service-testbed.c | 3 | ||||
-rw-r--r-- | src/testbed/testbed_api.c | 62 | ||||
-rw-r--r-- | src/testbed/testbed_api_hosts.c | 2 | ||||
-rw-r--r-- | src/testbed/testbed_api_services.c | 2 |
4 files changed, 30 insertions, 39 deletions
diff --git a/src/testbed/gnunet-service-testbed.c b/src/testbed/gnunet-service-testbed.c index c4ba665e3..bd163f1dd 100644 --- a/src/testbed/gnunet-service-testbed.c +++ b/src/testbed/gnunet-service-testbed.c | |||
@@ -1187,8 +1187,7 @@ handle_add_host (void *cls, struct GNUNET_SERVER_Client *client, | |||
1187 | host_id = ntohl (msg->host_id); | 1187 | host_id = ntohl (msg->host_id); |
1188 | LOG_DEBUG ("Received ADDHOST message\n"); | 1188 | LOG_DEBUG ("Received ADDHOST message\n"); |
1189 | LOG_DEBUG ("-------host id: %u\n", host_id); | 1189 | LOG_DEBUG ("-------host id: %u\n", host_id); |
1190 | if (NULL != hostname) | 1190 | LOG_DEBUG ("-------hostname: %s\n", hostname); |
1191 | LOG_DEBUG ("-------hostname: %s\n", hostname); | ||
1192 | if (0 != username_length) | 1191 | if (0 != username_length) |
1193 | LOG_DEBUG ("-------username: %s\n", username); | 1192 | LOG_DEBUG ("-------username: %s\n", username); |
1194 | else | 1193 | else |
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c index c1709333e..7808d7a34 100644 --- a/src/testbed/testbed_api.c +++ b/src/testbed/testbed_api.c | |||
@@ -272,7 +272,7 @@ handle_opsuccess (struct GNUNET_TESTBED_Controller *c, | |||
272 | GNUNET_TESTBED_GenericOperationSuccessEventMessage *msg) | 272 | GNUNET_TESTBED_GenericOperationSuccessEventMessage *msg) |
273 | { | 273 | { |
274 | struct OperationContext *opc; | 274 | struct OperationContext *opc; |
275 | struct GNUNET_TESTBED_EventInformation *event; | 275 | struct GNUNET_TESTBED_EventInformation event; |
276 | uint64_t op_id; | 276 | uint64_t op_id; |
277 | 277 | ||
278 | op_id = GNUNET_ntohll (msg->operation_id); | 278 | op_id = GNUNET_ntohll (msg->operation_id); |
@@ -282,55 +282,47 @@ handle_opsuccess (struct GNUNET_TESTBED_Controller *c, | |||
282 | LOG_DEBUG ("Operation not found\n"); | 282 | LOG_DEBUG ("Operation not found\n"); |
283 | return GNUNET_YES; | 283 | return GNUNET_YES; |
284 | } | 284 | } |
285 | event = NULL; | ||
286 | if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED))) | ||
287 | event = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_EventInformation)); | ||
288 | if (NULL != event) | ||
289 | event->type = GNUNET_TESTBED_ET_OPERATION_FINISHED; | ||
290 | switch (opc->type) | 285 | switch (opc->type) |
291 | { | 286 | { |
292 | case OP_FORWARDED: | 287 | case OP_FORWARDED: |
293 | { | 288 | { |
294 | struct ForwardedOperationData *fo_data; | 289 | struct ForwardedOperationData *fo_data; |
295 | 290 | ||
296 | fo_data = opc->data; | 291 | fo_data = opc->data; |
297 | if (NULL != fo_data->cc) | 292 | if (NULL != fo_data->cc) |
298 | fo_data->cc (fo_data->cc_cls, (const struct GNUNET_MessageHeader *) msg); | 293 | fo_data->cc (fo_data->cc_cls, (const struct GNUNET_MessageHeader *) msg); |
299 | GNUNET_CONTAINER_DLL_remove (c->ocq_head, c->ocq_tail, opc); | 294 | GNUNET_CONTAINER_DLL_remove (c->ocq_head, c->ocq_tail, opc); |
300 | GNUNET_free (fo_data); | 295 | GNUNET_free (fo_data); |
301 | GNUNET_free (opc); | 296 | GNUNET_free (opc); |
302 | return GNUNET_YES; | 297 | return GNUNET_YES; |
303 | } | 298 | } |
304 | break; | 299 | break; |
305 | case OP_PEER_DESTROY: | 300 | case OP_PEER_DESTROY: |
306 | { | 301 | { |
307 | struct GNUNET_TESTBED_Peer *peer; | 302 | struct GNUNET_TESTBED_Peer *peer; |
308 | 303 | ||
309 | peer = opc->data; | 304 | peer = opc->data; |
310 | GNUNET_free (peer); | 305 | GNUNET_free (peer); |
311 | opc->data = NULL; | 306 | opc->data = NULL; |
312 | //PEERDESTROYDATA | 307 | //PEERDESTROYDATA |
313 | } | 308 | } |
314 | break; | 309 | break; |
315 | case OP_LINK_CONTROLLERS: | 310 | case OP_LINK_CONTROLLERS: |
316 | break; | 311 | break; |
317 | default: | 312 | default: |
318 | GNUNET_assert (0); | 313 | GNUNET_assert (0); |
319 | } | 314 | } |
320 | if (NULL != event) | 315 | event.type = GNUNET_TESTBED_ET_OPERATION_FINISHED; |
321 | { | 316 | event.details.operation_finished.operation = opc->op; |
322 | event->details.operation_finished.operation = opc->op; | 317 | event.details.operation_finished.op_cls = NULL; |
323 | event->details.operation_finished.op_cls = NULL; | 318 | event.details.operation_finished.emsg = NULL; |
324 | event->details.operation_finished.emsg = NULL; | 319 | event.details.operation_finished.generic = NULL; |
325 | event->details.operation_finished.generic = NULL; | ||
326 | } | ||
327 | GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc); | 320 | GNUNET_CONTAINER_DLL_remove (opc->c->ocq_head, opc->c->ocq_tail, opc); |
328 | opc->state = OPC_STATE_FINISHED; | 321 | opc->state = OPC_STATE_FINISHED; |
329 | if (NULL != event) | 322 | if (0 != (c->event_mask & (1L << GNUNET_TESTBED_ET_OPERATION_FINISHED))) |
330 | { | 323 | { |
331 | if (NULL != c->cc) | 324 | if (NULL != c->cc) |
332 | c->cc (c->cc_cls, event); | 325 | c->cc (c->cc_cls, &event); |
333 | GNUNET_free (event); | ||
334 | } | 326 | } |
335 | return GNUNET_YES; | 327 | return GNUNET_YES; |
336 | } | 328 | } |
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index cbbc9fdee..b9cdfa0db 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c | |||
@@ -348,7 +348,7 @@ GNUNET_TESTBED_host_destroy (struct GNUNET_TESTBED_Host *host) | |||
348 | } | 348 | } |
349 | host_list = | 349 | host_list = |
350 | GNUNET_realloc (host_list, | 350 | GNUNET_realloc (host_list, |
351 | sizeof (struct GNUNET_TESTBED_Host) * host_list_size); | 351 | sizeof (struct GNUNET_TESTBED_Host *) * host_list_size); |
352 | } | 352 | } |
353 | 353 | ||
354 | 354 | ||
diff --git a/src/testbed/testbed_api_services.c b/src/testbed/testbed_api_services.c index 62bafb724..78d441c61 100644 --- a/src/testbed/testbed_api_services.c +++ b/src/testbed/testbed_api_services.c | |||
@@ -142,6 +142,7 @@ configuration_receiver (void *cls, const struct GNUNET_MessageHeader *msg) | |||
142 | struct GNUNET_TESTBED_EventInformation info; | 142 | struct GNUNET_TESTBED_EventInformation info; |
143 | uint16_t mtype; | 143 | uint16_t mtype; |
144 | 144 | ||
145 | c = data->peer->controller; | ||
145 | mtype = ntohs (msg->type); | 146 | mtype = ntohs (msg->type); |
146 | emsg = NULL; | 147 | emsg = NULL; |
147 | info.type = GNUNET_TESTBED_ET_OPERATION_FINISHED; | 148 | info.type = GNUNET_TESTBED_ET_OPERATION_FINISHED; |
@@ -165,7 +166,6 @@ configuration_receiver (void *cls, const struct GNUNET_MessageHeader *msg) | |||
165 | data->op_result = data->ca (data->cada_cls, data->cfg); | 166 | data->op_result = data->ca (data->cada_cls, data->cfg); |
166 | info.details.operation_finished.emsg = NULL; | 167 | info.details.operation_finished.emsg = NULL; |
167 | info.details.operation_finished.generic = data->op_result; | 168 | info.details.operation_finished.generic = data->op_result; |
168 | c = data->peer->controller; | ||
169 | data->state = SERVICE_CONNECTED; | 169 | data->state = SERVICE_CONNECTED; |
170 | 170 | ||
171 | call_cb: | 171 | call_cb: |