From abffd969486861306201f42b78822bf9ac6f18a4 Mon Sep 17 00:00:00 2001 From: Vlasta Vesely Date: Wed, 16 May 2018 14:58:47 +0200 Subject: [PATCH] cs --- main.c | 7 +++---- syllable.c | 7 ++++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 78cfc7a..5b5a1b1 100644 --- a/main.c +++ b/main.c @@ -62,10 +62,9 @@ int main(int argc, const char **argv) } } - if (flags & FLAG_CZECH) - context = transliteration_context_iast_czech_alloc(); - else - context = transliteration_context_iast_alloc(); + context = (flags & FLAG_CZECH) + ? transliteration_context_iast_czech_alloc() + : transliteration_context_iast_alloc(); if (flags & FLAG_STDIN) { input = stdin_read(); diff --git a/syllable.c b/syllable.c index 0146931..15eb039 100644 --- a/syllable.c +++ b/syllable.c @@ -10,18 +10,23 @@ struct syllable *syllable_alloc(const char *data) struct syllable *ptr = malloc(sizeof(*ptr)); if (ptr == NULL) - return NULL; + goto out; ptr->data = strdup(data); ptr->code = 0; ptr->prev = NULL; ptr->next = NULL; +out: return ptr; } void syllable_drop(struct syllable *ptr) { + if (ptr == NULL) + return; + + free(ptr->data); free(ptr); }