Firmware updater: Fix a race condition

avrdude: Handle OOM with configurable handler
This commit is contained in:
Vojtech Kral 2018-08-07 11:28:39 +02:00 committed by bubnikv
parent bd667aad6e
commit 60a0375ff9
14 changed files with 193 additions and 67 deletions

View file

@ -63,9 +63,10 @@ struct pdata
static void butterfly_setup(PROGRAMMER * pgm)
{
if ((pgm->cookie = malloc(sizeof(struct pdata))) == 0) {
avrdude_message(MSG_INFO, "%s: butterfly_setup(): Out of memory allocating private data\n",
progname);
exit(1);
// avrdude_message(MSG_INFO, "%s: butterfly_setup(): Out of memory allocating private data\n",
// progname);
// exit(1);
avrdude_oom("butterfly_setup(): Out of memory allocating private data\n");
}
memset(pgm->cookie, 0, sizeof(struct pdata));
}