summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/arch/register.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/arch/register.c b/src/arch/register.c
index 6194a28..0033071 100644
--- a/src/arch/register.c
+++ b/src/arch/register.c
@@ -321,6 +321,7 @@ static void g_register_operand_class_init(GRegisterOperandClass *klass)
static void g_register_operand_init(GRegisterOperand *operand)
{
+ operand->reg = NULL;
operand->is_written = false;
}
@@ -340,7 +341,8 @@ static void g_register_operand_init(GRegisterOperand *operand)
static void g_register_operand_dispose(GRegisterOperand *operand)
{
- g_object_unref(G_OBJECT(operand->reg));
+ if (operand->reg != NULL)
+ g_object_unref(G_OBJECT(operand->reg));
G_OBJECT_CLASS(g_register_operand_parent_class)->dispose(G_OBJECT(operand));