ft2232_init() fails if the command buffer can not be allocated, but ft2232_quit() will be called to clean up, so the command buffer must be free():d only if it has been successfully allocated. --- src/jtag/drivers/ft2232.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c index 9315eff..aba7f14 100644 --- a/src/jtag/drivers/ft2232.c +++ b/src/jtag/drivers/ft2232.c @@ -2459,6 +2459,8 @@ static int ft2232_init(void) ft2232_buffer_size = 0; ft2232_buffer = malloc(FT2232_BUFFER_SIZE); + if (!ft2232_buffer) + goto quit; if (layout->init() != ERROR_OK) goto quit; @@ -3225,7 +3227,8 @@ static int ft2232_quit(void) ftdi_deinit(&ftdic); #endif - free(ft2232_buffer); + if (ft2232_buffer) + free(ft2232_buffer); ft2232_buffer = NULL; return ERROR_OK; -- 1.7.4.1.343.ga91df.dirty _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development