From 5644f93fb94d9dc472218fe3859ae91480f9d032 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 30 Mar 2016 19:00:28 +0000 Subject: [PATCH] Bug fix: Double free at end of run if burn_write_opts_set_leadin_text() is used --- libburn/trunk/cdrskin/cdrskin_timestamp.h | 2 +- libburn/trunk/libburn/options.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libburn/trunk/cdrskin/cdrskin_timestamp.h b/libburn/trunk/cdrskin/cdrskin_timestamp.h index 8bd533e8..79de3e86 100644 --- a/libburn/trunk/cdrskin/cdrskin_timestamp.h +++ b/libburn/trunk/cdrskin/cdrskin_timestamp.h @@ -1 +1 @@ -#define Cdrskin_timestamP "2016.03.30.113137" +#define Cdrskin_timestamP "2016.03.30.185545" diff --git a/libburn/trunk/libburn/options.c b/libburn/trunk/libburn/options.c index 7cc0a53a..3f535072 100644 --- a/libburn/trunk/libburn/options.c +++ b/libburn/trunk/libburn/options.c @@ -89,12 +89,22 @@ int burn_write_opts_clone(struct burn_write_opts *from, return 1; *to = calloc(1, sizeof(struct burn_write_opts)); if (*to == NULL) { +out_of_mem:; libdax_msgs_submit(libdax_messenger, -1, 0x00000003, LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH, "Out of virtual memory", 0, 0); return -1; } memcpy(*to, from, sizeof(struct burn_write_opts)); + (*to)->text_packs = NULL; + (*to)->num_text_packs = 0; + if (from->text_packs != NULL && from->num_text_packs > 0) { + (*to)->text_packs = calloc(1, from->num_text_packs * 18); + if ((*to)->text_packs == NULL) + goto out_of_mem; + memcpy((*to)->text_packs, from->text_packs, + from->num_text_packs * 18); + } (*to)->refcount= 1; return 1; }