static RList *r_bin_wasm_get_export_entries (RBinWasmObj *bin, RBinWasmSection *sec) {
	RList *ret = NULL;
	RBinWasmExportEntry *ptr = NULL;

	if (!(ret = r_list_newf ((RListFree)free))) {
		return NULL;
	}

	ut8* buf = bin->buf->buf + (ut32)sec->payload_data;
	ut32 len =  sec->payload_len;
	ut32 count = sec->count;
	ut32 i = 0, r = 0;

	while (i < len && r < count) {
		if (!(ptr = R_NEW0 (RBinWasmExportEntry))) {
			return ret;
		}

		if (!(consume_u32 (buf + i, buf + len, &ptr->field_len, &i))) {
			free (ptr);
			return ret;
		}

		if (!(consume_str (buf + i, buf + len, ptr->field_len, ptr->field_str, &i))) {
			free (ptr);
			return ret;
		}

		if (!(consume_u8 (buf + i, buf + len, &ptr->kind, &i))) {
			free (ptr);
			return ret;
		}

		if (!(consume_u32 (buf + i, buf + len, &ptr->index, &i))) {
			free (ptr);
			return ret;
		}

		r_list_append (ret, ptr);
		r++;
	}
	return ret;
}
static RList *r_bin_wasm_get_export_entries (RBinWasmObj *bin, RBinWasmSection *sec) {
	RList *ret = NULL;
	RBinWasmExportEntry *ptr = NULL;

	if (!(ret = r_list_newf ((RListFree)free))) {
		return NULL;
	}

	ut8* buf = bin->buf->buf + (ut32)sec->payload_data;
	ut32 len =  sec->payload_len;
	ut32 count = sec->count;
	ut32 i = 0, r = 0;

	while (i < len && r < count) {
		if (!(ptr = R_NEW0 (RBinWasmExportEntry))) {
			return ret;
		}

		if (!(consume_u32 (buf + i, buf + len, &ptr->field_len, &i))) {
			free (ptr);
			return ret;
		}

		if (!(consume_str (buf + i, buf + len, ptr->field_len, ptr->field_str, &i))) {
			free (ptr);
			return ret;
		}

		if (!(consume_u8 (buf + i, buf + len, &ptr->kind, &i))) {
			free (ptr);
			return ret;
		}

		if (!(consume_u32 (buf + i, buf + len, &ptr->index, &i))) {
			free (ptr);
			return ret;
		}

		r_list_append (ret, ptr);
		r++;
	}
	return ret;
}