Signed-off-by: Vitezslav Samel <vitezslav(a)samel.cz>
---
src/othptab.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/src/othptab.c b/src/othptab.c
index 2aa54f5..3d6c7bd 100644
--- a/src/othptab.c
+++ b/src/othptab.c
@@ -771,19 +771,12 @@ void refresh_othwindow(struct othptable *table)
void destroyothptable(struct othptable *table)
{
- struct othptabent *ctemp;
- struct othptabent *ctemp_next;
+ struct othptabent *ctemp = table->head;
- if (table->head != NULL) {
- ctemp = table->head;
- ctemp_next = table->head->next_entry;
+ while (ctemp != NULL) {
+ struct othptabent *next = ctemp->next_entry;
- while (ctemp != NULL) {
- free(ctemp);
- ctemp = ctemp_next;
-
- if (ctemp_next != NULL)
- ctemp_next = ctemp_next->next_entry;
- }
+ free(ctemp);
+ ctemp = next;
}
}
--
1.9.1