From 9f72d296dc684cf9aebe2778548c9cb5465cfd7a Mon Sep 17 00:00:00 2001 From: Daniel Beer Date: Thu, 29 Nov 2012 07:55:36 +1300 Subject: [PATCH] Fix incorrect initialization of transports. --- transport/cdc_acm.c | 1 + transport/rf2500.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/transport/cdc_acm.c b/transport/cdc_acm.c index f2fb102..039850d 100644 --- a/transport/cdc_acm.c +++ b/transport/cdc_acm.c @@ -283,6 +283,7 @@ transport_t cdc_acm_open(const char *devpath, const char *requested_serial, return NULL; } + memset(tr, 0, sizeof(*tr)); tr->base.ops = &cdc_acm_class; usb_init(); diff --git a/transport/rf2500.c b/transport/rf2500.c index 3510edc..1ad804a 100644 --- a/transport/rf2500.c +++ b/transport/rf2500.c @@ -190,8 +190,9 @@ static void usbtr_destroy(transport_t tr_base) static int usbtr_flush(transport_t tr_base) { -#ifndef __APPLE__ struct rf2500_transport *tr = (struct rf2500_transport *)tr_base; + +#ifndef __APPLE__ char buf[64]; /* Flush out lingering data. @@ -204,6 +205,8 @@ static int usbtr_flush(transport_t tr_base) 100) > 0); #endif + tr->len = 0; + tr->offset = 0; return 0; } @@ -231,6 +234,7 @@ transport_t rf2500_open(const char *devpath, const char *requested_serial) return NULL; } + memset(tr, 0, sizeof(*tr)); tr->base.ops = &rf2500_transport; usb_init();