Bug fix: Double free at end of run if burn_write_opts_set_leadin_text() is used

This commit is contained in:
Thomas Schmitt 2016-03-30 19:00:28 +00:00
parent 32ece23bde
commit 5644f93fb9
2 changed files with 11 additions and 1 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2016.03.30.113137" #define Cdrskin_timestamP "2016.03.30.185545"

View File

@ -89,12 +89,22 @@ int burn_write_opts_clone(struct burn_write_opts *from,
return 1; return 1;
*to = calloc(1, sizeof(struct burn_write_opts)); *to = calloc(1, sizeof(struct burn_write_opts));
if (*to == NULL) { if (*to == NULL) {
out_of_mem:;
libdax_msgs_submit(libdax_messenger, -1, 0x00000003, libdax_msgs_submit(libdax_messenger, -1, 0x00000003,
LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH, LIBDAX_MSGS_SEV_FATAL, LIBDAX_MSGS_PRIO_HIGH,
"Out of virtual memory", 0, 0); "Out of virtual memory", 0, 0);
return -1; return -1;
} }
memcpy(*to, from, sizeof(struct burn_write_opts)); 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; (*to)->refcount= 1;
return 1; return 1;
} }