aboutsummaryrefslogtreecommitdiff
path: root/src/gnsrecord/gnsrecord_misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gnsrecord/gnsrecord_misc.c')
-rw-r--r--src/gnsrecord/gnsrecord_misc.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c
index 82c38f19a..b907eed27 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/gnsrecord/gnsrecord_misc.c
@@ -296,15 +296,20 @@ GNUNET_GNSRECORD_data_from_identity (const struct
296 size_t *data_size, 296 size_t *data_size,
297 uint32_t *type) 297 uint32_t *type)
298{ 298{
299 char *tmp;
299 *type = ntohl (key->type); 300 *type = ntohl (key->type);
300 *data_size = GNUNET_IDENTITY_key_get_length (key); 301 *data_size = GNUNET_IDENTITY_key_get_length (key);
301 if (0 == *data_size) 302 if (0 == *data_size)
302 return GNUNET_SYSERR; 303 return GNUNET_SYSERR;
303 *data = GNUNET_malloc (*data_size); 304 tmp = GNUNET_malloc (*data_size);
304 return (GNUNET_IDENTITY_write_key_to_buffer (key, *data, *data_size) == 305 if (GNUNET_IDENTITY_write_key_to_buffer (key, tmp, *data_size)
305 *data_size? 306 != *data_size) {
306 GNUNET_OK : 307 GNUNET_free (tmp);
307 GNUNET_SYSERR); 308 *data_size = 0;
309 return GNUNET_SYSERR;
310 }
311 *data = tmp;
312 return GNUNET_OK;
308} 313}
309 314
310 315
@@ -350,7 +355,7 @@ GNUNET_GNSRECORD_block_get_expiration (const struct
350 case GNUNET_GNSRECORD_TYPE_PKEY: 355 case GNUNET_GNSRECORD_TYPE_PKEY:
351 return GNUNET_TIME_absolute_ntoh (block->ecdsa_block.expiration_time); 356 return GNUNET_TIME_absolute_ntoh (block->ecdsa_block.expiration_time);
352 default: 357 default:
353 return GNUNET_TIME_absolute_get_zero_ (); 358 GNUNET_break (0); /* Hopefully we never get here, but we might */
354 } 359 }
355 return GNUNET_TIME_absolute_get_zero_ (); 360 return GNUNET_TIME_absolute_get_zero_ ();
356 361