Move destructor prior to return

This commit is contained in:
Yang Gu 2010-05-26 22:39:14 +08:00 committed by Denis Kenzior
parent 6643e115a8
commit 31b65ef8ab
1 changed files with 27 additions and 33 deletions

View File

@ -2112,11 +2112,11 @@ static gboolean parse_display_text(struct stk_command *command,
&obj->frame_id, &obj->frame_id,
STK_DATA_OBJECT_TYPE_INVALID); STK_DATA_OBJECT_TYPE_INVALID);
command->destructor = destroy_display_text;
if (ret == FALSE) if (ret == FALSE)
return FALSE; return FALSE;
command->destructor = destroy_display_text;
return TRUE; return TRUE;
} }
@ -2150,11 +2150,11 @@ static gboolean parse_get_inkey(struct stk_command *command,
&obj->frame_id, &obj->frame_id,
STK_DATA_OBJECT_TYPE_INVALID); STK_DATA_OBJECT_TYPE_INVALID);
command->destructor = destroy_get_inkey;
if (ret == FALSE) if (ret == FALSE)
return FALSE; return FALSE;
command->destructor = destroy_get_inkey;
return TRUE; return TRUE;
} }
@ -2192,11 +2192,11 @@ static gboolean parse_get_input(struct stk_command *command,
&obj->frame_id, &obj->frame_id,
STK_DATA_OBJECT_TYPE_INVALID); STK_DATA_OBJECT_TYPE_INVALID);
command->destructor = destroy_get_input;
if (ret == FALSE) if (ret == FALSE)
return FALSE; return FALSE;
command->destructor = destroy_get_input;
return TRUE; return TRUE;
} }
@ -2243,11 +2243,11 @@ static gboolean parse_play_tone(struct stk_command *command,
&obj->frame_id, &obj->frame_id,
STK_DATA_OBJECT_TYPE_INVALID); STK_DATA_OBJECT_TYPE_INVALID);
command->destructor = destroy_play_tone;
if (ret == FALSE) if (ret == FALSE)
return FALSE; return FALSE;
command->destructor = destroy_play_tone;
return TRUE; return TRUE;
} }
@ -2271,8 +2271,6 @@ static gboolean parse_poll_interval(struct stk_command *command,
if (ret == FALSE) if (ret == FALSE)
return FALSE; return FALSE;
command->destructor = NULL;
return TRUE; return TRUE;
} }
@ -2323,10 +2321,12 @@ static gboolean parse_setup_menu(struct stk_command *command,
gboolean ret; gboolean ret;
if (command->src != STK_DEVICE_IDENTITY_TYPE_UICC) if (command->src != STK_DEVICE_IDENTITY_TYPE_UICC)
goto error; return FALSE;
if (command->dst != STK_DEVICE_IDENTITY_TYPE_TERMINAL) if (command->dst != STK_DEVICE_IDENTITY_TYPE_TERMINAL)
goto error; return FALSE;
command->destructor = destroy_setup_menu;
ret = parse_dataobj(iter, ret = parse_dataobj(iter,
STK_DATA_OBJECT_TYPE_ALPHA_ID, STK_DATA_OBJECT_TYPE_ALPHA_ID,
@ -2335,12 +2335,12 @@ static gboolean parse_setup_menu(struct stk_command *command,
STK_DATA_OBJECT_TYPE_INVALID); STK_DATA_OBJECT_TYPE_INVALID);
if (ret == FALSE) if (ret == FALSE)
goto error; return FALSE;
obj->items = parse_item_list(iter); obj->items = parse_item_list(iter);
if (obj->items == NULL) if (obj->items == NULL)
goto error; return FALSE;
ret = parse_dataobj(iter, ret = parse_dataobj(iter,
STK_DATA_OBJECT_TYPE_ITEMS_NEXT_ACTION_INDICATOR, 0, STK_DATA_OBJECT_TYPE_ITEMS_NEXT_ACTION_INDICATOR, 0,
@ -2356,15 +2356,9 @@ static gboolean parse_setup_menu(struct stk_command *command,
STK_DATA_OBJECT_TYPE_INVALID); STK_DATA_OBJECT_TYPE_INVALID);
if (ret == FALSE) if (ret == FALSE)
goto error; return FALSE;
command->destructor = destroy_setup_menu;
return TRUE; return TRUE;
error:
destroy_setup_menu(command);
return FALSE;
} }
static void destroy_select_item(struct stk_command *command) static void destroy_select_item(struct stk_command *command)
@ -2542,11 +2536,11 @@ static gboolean parse_setup_call(struct stk_command *command,
&obj->frame_id, &obj->frame_id,
STK_DATA_OBJECT_TYPE_INVALID); STK_DATA_OBJECT_TYPE_INVALID);
command->destructor = destroy_setup_call;
if (ret == FALSE) if (ret == FALSE)
return FALSE; return FALSE;
command->destructor = destroy_setup_call;
return TRUE; return TRUE;
} }
@ -2583,11 +2577,11 @@ static gboolean parse_refresh(struct stk_command *command,
&obj->frame_id, &obj->frame_id,
STK_DATA_OBJECT_TYPE_INVALID); STK_DATA_OBJECT_TYPE_INVALID);
command->destructor = destroy_refresh;
if (ret == FALSE) if (ret == FALSE)
return FALSE; return FALSE;
command->destructor = destroy_refresh;
return TRUE; return TRUE;
} }
@ -2766,11 +2760,11 @@ static gboolean parse_setup_idle_mode_text(struct stk_command *command,
&obj->frame_id, &obj->frame_id,
STK_DATA_OBJECT_TYPE_INVALID); STK_DATA_OBJECT_TYPE_INVALID);
command->destructor = destroy_setup_idle_mode_text;
if (ret == FALSE) if (ret == FALSE)
return FALSE; return FALSE;
command->destructor = destroy_setup_idle_mode_text;
return TRUE; return TRUE;
} }
@ -2805,11 +2799,11 @@ static gboolean parse_run_at_command(struct stk_command *command,
&obj->frame_id, &obj->frame_id,
STK_DATA_OBJECT_TYPE_INVALID); STK_DATA_OBJECT_TYPE_INVALID);
command->destructor = destroy_run_at_command;
if (ret == FALSE) if (ret == FALSE)
return FALSE; return FALSE;
command->destructor = destroy_run_at_command;
return TRUE; return TRUE;
} }
@ -2844,11 +2838,11 @@ static gboolean parse_send_dtmf(struct stk_command *command,
&obj->frame_id, &obj->frame_id,
STK_DATA_OBJECT_TYPE_INVALID); STK_DATA_OBJECT_TYPE_INVALID);
command->destructor = destroy_send_dtmf;
if (ret == FALSE) if (ret == FALSE)
return FALSE; return FALSE;
command->destructor = destroy_send_dtmf;
return TRUE; return TRUE;
} }
@ -2963,11 +2957,11 @@ static gboolean parse_launch_browser(struct stk_command *command,
&obj->text_passwd, &obj->text_passwd,
STK_DATA_OBJECT_TYPE_INVALID); STK_DATA_OBJECT_TYPE_INVALID);
command->destructor = destroy_launch_browser;
if (ret == FALSE) if (ret == FALSE)
return FALSE; return FALSE;
command->destructor = destroy_launch_browser;
return TRUE; return TRUE;
error: error: