Ejemplo n.º 1
0
void bu256_freep(void *bu256_v)
{
	bu256_t *v = bu256_v;
	if (!v)
		return;

	bu256_free(v);

	memset(v, 0, sizeof(*v));
	free(v);
}
Ejemplo n.º 2
0
static bool add_orphan(const bu256_t *hash_in, struct const_buffer *buf_in)
{
	if (have_orphan(hash_in))
		return false;

	bu256_t *hash = bu256_new(hash_in);
	if (!hash) {
		fprintf(plog, "OOM\n");
		return false;
	}

	struct buffer *buf = buffer_copy(buf_in->p, buf_in->len);
	if (!buf) {
		bu256_free(hash);
		fprintf(plog, "OOM\n");
		return false;
	}

	bp_hashtab_put(orphans, hash, buf);
	
	return true;
}