lorid

convert chordpro to pdf
git clone git://git.relim.de/lorid.git
Log | Files | Refs | README | LICENSE

commit 8b5f6bdda39bfad2a43b1560546038be4842d02b
parent 9328d2599cff8eb4a1dc7e0967fd60c003a96a31
Author: nibo <nibo@relim.de>
Date:   Mon, 28 Jul 2025 06:13:21 +0200

Cleanup after check if title exist

Diffstat:
Msrc/chordpro.c | 2+-
Msrc/out_pdf.c | 8+++++++-
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/chordpro.c b/src/chordpro.c @@ -6553,7 +6553,6 @@ cho_songs_parse(const char *str, const char *chordpro_filepath, struct Config *c goto ERR; } cho_songs_close(&ctx, lines); - cho_context_cleanup(&ctx); bool exist_title = false; for (ctx.so = 0; ctx.songs[ctx.so]; ctx.so++) { for (ctx.m = 0; ctx.songs[ctx.so]->metadata[ctx.m]; ctx.m++) { @@ -6573,6 +6572,7 @@ cho_songs_parse(const char *str, const char *chordpro_filepath, struct Config *c } exist_title = false; } + cho_context_cleanup(&ctx); return ctx.songs; ERR: cho_songs_close(&ctx, lines); diff --git a/src/out_pdf.c b/src/out_pdf.c @@ -26,6 +26,9 @@ obj_new(void) static void obj_free(struct Obj *obj) { + if (!obj) { + return; + } free(obj->name); free(obj); } @@ -390,7 +393,7 @@ pdf_load_fonts(struct PDFContext *ctx, struct Font **needed_fonts) const char *name; int index; struct Font **f; - struct Obj *fnt; + struct Obj *fnt = NULL; for (f = needed_fonts; *f; f++) { if (font_name_is_path((*f)->family)) { @@ -1809,6 +1812,9 @@ pdf_page_add_page_no( case ALIGNMENT_RIGHT: x = MEDIABOX_WIDTH - MARGIN_HORIZONTAL / 2 - width; break; + default: + util_log(NULL, 0, LOG_ERR, "Invalid Alignment enum value '%d'.", ctx->config->output->page_no->align); + return false; } (*texts)[c_ctx->text]->x = x; c_ctx->text++;