Tomek CEDRO wrote:
> The new source code (after patching)  have 6 functions doing almost
> the same: ft2232_init_ftd2xx(), ft2232_open_ftd2xx(),
> ft2232_init_libftdi(), ft2232_open_libftdi(),  ft2232_init_sub(void),
> ft2232_init() and the header update ;-)

Student code galore.


> I can understand that leaving allocated memory is bad. However there
> is a simpler solution to the problem (patch attached) by only changing
> few lines of existing code and leaving driver infrastructure/layout
> common for all source code:
> 
>      ft2232_buffer_size = 0;
>      ft2232_buffer = malloc(FT2232_BUFFER_SIZE); <-- this is the bad malloc
> 
> *     for (;;){
> 
> *        if (layout->init() != ERROR_OK) break; <-- we jump out on failure

Please just use goto to handle errors.


//Peter
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to