const struct GNUNET_GNSRECORD_Data *token_record;
const struct GNUNET_GNSRECORD_Data *token_metadata_record;
struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key;
+ struct GNUNET_CRYPTO_EcdhePrivateKey *priv_key;
//There should be only a single record for a token under a label
if (2 != rd_count)
}
//Get metadata and decrypt token
- ecdhe_privkey = *((struct GNUNET_CRYPTO_EcdhePrivateKey *)token_metadata_record->data);
- aud_key = (struct GNUNET_CRYPTO_EcdsaPublicKey *)&(&ecdhe_privkey)[1];
+ priv_key = (struct GNUNET_CRYPTO_EcdhePrivateKey *)token_metadata_record->data;
+ ecdhe_privkey = *priv_key;
+ aud_key = (struct GNUNET_CRYPTO_EcdsaPublicKey *)&priv_key[1];
scopes = GNUNET_strdup ((char*) aud_key+sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
token_parse2 (token_record->data,
GNUNET_CONTAINER_DLL_insert (attr->val_head,
attr->val_tail,
val);
- GNUNET_CONTAINER_multihashmap_put (ego_entry->attr_map,
- &key,
- attr,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CONTAINER_multihashmap_put (ego_entry->attr_map,
+ &key,
+ attr,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
}
GNUNET_NAMESTORE_zone_iterator_next (ns_it);
return GNUNET_SYSERR;
}
- buffer = GNUNET_malloc (size) + 1;
+ buffer = GNUNET_malloc (size + 1);
if (GNUNET_SYSERR ==
GNUNET_DISK_file_read (fh,
buffer,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Unable to read file: %s.\n"),
afsdir);
+ GNUNET_free (buffer);
+ GNUNET_DISK_file_close (fh);
return GNUNET_SYSERR;
}
+ buffer[size] = '\0';
GNUNET_DISK_file_close (fh);
if (0 < size)
line,
strlen (line));
+ GNUNET_free (line);
GNUNET_free (entry->private_key);
GNUNET_free (entry->label);
GNUNET_free (entry->record_data);