diff --git a/Makefile b/Makefile index c3e1137..d161c89 100755 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ rpiboot: main.c - $(CC) -g -o $@ $< -lusb-1.0 + $(CC) -Wall -Wextra -g -o $@ $< -lusb-1.0 uninstall: rm -f /usr/bin/rpiboot diff --git a/main.c b/main.c index a359738..a89e2ca 100755 --- a/main.c +++ b/main.c @@ -127,7 +127,7 @@ int Initialize_Device(libusb_context ** ctx, libusb_device_handle ** usb_device) int ep_write(void *buf, int len, libusb_device_handle * usb_device) { - int a_len; + int a_len = 0; int ret = libusb_control_transfer(usb_device, LIBUSB_REQUEST_TYPE_VENDOR, 0, len & 0xffff, len >> 16, NULL, 0, 1000); @@ -362,11 +362,13 @@ int file_server(libusb_device_handle * usb_device) if(read != file_size) { printf("Failed to read from input file\n"); + free(buf); return -1; } int sz = ep_write(buf, file_size, usb_device); + free(buf); fclose(fp); fp = NULL;