aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-09-24 12:59:42 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-09-24 12:59:42 +0000
commitdbe7cda38fe4464992c8798306f1641162cdce41 (patch)
tree53e01d8971addb8583880650f96f4735048bcf01 /src/namestore
parent1e7944dc58b57d8f38b26d760b08b6e5abcb07b7 (diff)
downloadgnunet-dbe7cda38fe4464992c8798306f1641162cdce41.tar.gz
gnunet-dbe7cda38fe4464992c8798306f1641162cdce41.zip
- coverity
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/namestore_common.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/namestore/namestore_common.c b/src/namestore/namestore_common.c
index 83bc07c39..8c42bad67 100644
--- a/src/namestore/namestore_common.c
+++ b/src/namestore/namestore_common.c
@@ -381,13 +381,15 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
381 soa = (struct soa_data*)data; 381 soa = (struct soa_data*)data;
382 soa_rname = (char*)&soa[1]; 382 soa_rname = (char*)&soa[1];
383 soa_mname = (char*)&soa[1]+strlen(soa_rname)+1; 383 soa_mname = (char*)&soa[1]+strlen(soa_rname)+1;
384 if (GNUNET_asprintf(&result, "rname=%s mname=%s %lu,%lu,%lu,%lu,%lu", 384 if (0 == GNUNET_asprintf(&result, "rname=%s mname=%s %lu,%lu,%lu,%lu,%lu",
385 soa_rname, soa_mname, 385 soa_rname, soa_mname,
386 ntohl (soa->serial), ntohl (soa->refresh), 386 ntohl (soa->serial), ntohl (soa->refresh),
387 ntohl (soa->retry), ntohl (soa->expire), ntohl (soa->minimum))) 387 ntohl (soa->retry), ntohl (soa->expire), ntohl (soa->minimum)))
388 return result; 388 {
389 else 389 GNUNET_free (result);
390 return NULL; 390 return NULL;
391 }
392 return result;
391 case GNUNET_DNSPARSER_TYPE_PTR: 393 case GNUNET_DNSPARSER_TYPE_PTR:
392 return GNUNET_strndup (data, data_size); 394 return GNUNET_strndup (data, data_size);
393 case GNUNET_DNSPARSER_TYPE_MX: 395 case GNUNET_DNSPARSER_TYPE_MX:
@@ -396,7 +398,10 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
396 != 0) 398 != 0)
397 return result; 399 return result;
398 else 400 else
401 {
402 GNUNET_free (result);
399 return NULL; 403 return NULL;
404 }
400 case GNUNET_DNSPARSER_TYPE_TXT: 405 case GNUNET_DNSPARSER_TYPE_TXT:
401 return GNUNET_strndup (data, data_size); 406 return GNUNET_strndup (data, data_size);
402 case GNUNET_DNSPARSER_TYPE_AAAA: 407 case GNUNET_DNSPARSER_TYPE_AAAA:
@@ -419,31 +424,40 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type,
419 vpn = (struct vpn_data*)data; 424 vpn = (struct vpn_data*)data;
420 425
421 GNUNET_CRYPTO_hash_to_enc (&vpn->peer, &s_peer); 426 GNUNET_CRYPTO_hash_to_enc (&vpn->peer, &s_peer);
422 if (GNUNET_OK != GNUNET_asprintf (&vpn_str, "%hu %s %s", 427 if (0 == GNUNET_asprintf (&vpn_str, "%hu %s %s",
423 vpn->proto, 428 vpn->proto,
424 (char*)&s_peer, 429 (char*)&s_peer,
425 (char*)&vpn[1])) 430 (char*)&vpn[1]))
426 return NULL; 431 {
432 GNUNET_free (vpn_str);
433 return NULL;
434 }
427 return vpn_str; 435 return vpn_str;
428 case GNUNET_DNSPARSER_TYPE_SRV: 436 case GNUNET_DNSPARSER_TYPE_SRV:
429 srv = (struct srv_data*)data; 437 srv = (struct srv_data*)data;
430 438
431 if (GNUNET_OK != GNUNET_asprintf (&srv_str, "%d %d %d %s", 439 if (0 == GNUNET_asprintf (&srv_str, "%d %d %d %s",
432 ntohs (srv->prio), 440 ntohs (srv->prio),
433 ntohs (srv->weight), 441 ntohs (srv->weight),
434 ntohs (srv->port), 442 ntohs (srv->port),
435 (char*)&srv[1])) 443 (char*)&srv[1]))
444 {
445 GNUNET_free (srv_str);
436 return NULL; 446 return NULL;
447 }
437 return srv_str; 448 return srv_str;
438 case GNUNET_DNSPARSER_TYPE_TLSA: 449 case GNUNET_DNSPARSER_TYPE_TLSA:
439 tlsa = (struct tlsa_data*)data; 450 tlsa = (struct tlsa_data*)data;
440 451
441 if (GNUNET_OK != GNUNET_asprintf (&tlsa_str, "%c %c %c %s", 452 if (0 == GNUNET_asprintf (&tlsa_str, "%c %c %c %s",
442 tlsa->usage, 453 tlsa->usage,
443 tlsa->selector, 454 tlsa->selector,
444 tlsa->matching_type, 455 tlsa->matching_type,
445 tlsa[1])) 456 tlsa[1]))
446 return NULL; 457 {
458 GNUNET_free (tlsa_str);
459 return NULL;
460 }
447 return tlsa_str; 461 return tlsa_str;
448 default: 462 default:
449 GNUNET_break (0); 463 GNUNET_break (0);