From fbe10a55c08b93fc67c685616cff3de2a604ad24 Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Thu, 27 Feb 2014 23:59:08 +0800 Subject: [PATCH] simplify cs_close() when freeing @printer_info, making it future proof for future arch --- cs.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/cs.c b/cs.c index e7e13b99..cf60bee0 100644 --- a/cs.c +++ b/cs.c @@ -185,18 +185,8 @@ cs_err cs_close(csh *handle) struct cs_struct *ud = (struct cs_struct *)(*handle); - switch (ud->arch) { - case CS_ARCH_X86: - break; - case CS_ARCH_ARM: - case CS_ARCH_MIPS: - case CS_ARCH_ARM64: - case CS_ARCH_PPC: - cs_mem_free(ud->printer_info); - break; - default: // unsupported architecture - return CS_ERR_HANDLE; - } + if (ud->printer_info) + cs_mem_free(ud->printer_info); // arch_destroy[ud->arch](ud);