fixed memory leak (in a few h memory would be full) thestack/untested_code_for_lewurm
authortheStack <sebastian.falbesoner@gmail.com>
Thu, 24 Sep 2009 02:12:07 +0000 (04:12 +0200)
committertheStack <sebastian.falbesoner@gmail.com>
Thu, 24 Sep 2009 02:12:07 +0000 (04:12 +0200)
better solution in this case: let not return usb_hidkb_getChars()
newly allocated structure, but instead the user should provide
memory for the structure and let him pass a pointer to that structure
to the function (but i didn't want to change the interface so far)

main.c

diff --git a/main.c b/main.c
index 13524d596aecf14fbccb691affde6e0708ec04fe..6c30ab6cbdee73d17f98ecfe64b38f49cc25cb23 100644 (file)
--- a/main.c
+++ b/main.c
@@ -189,6 +189,7 @@ int main(void)
                                y = STDOUT_BORDER_TOP;
                        }
                }
+               free(k);
                if(j > 0) { /* when there was any printable stuff, show it */
                        print_str_noscroll(old_x, old_y, str);
                        printf("y: %d\n", y);