Index: uspace/lib/usbhost/include/usb/host/endpoint.h
===================================================================
--- uspace/lib/usbhost/include/usb/host/endpoint.h	(revision e6576355a3cebfb1925a5a55ba5aa821db40fac2)
+++ uspace/lib/usbhost/include/usb/host/endpoint.h	(revision db4c43e127e6198b20ef344ad44fdf6dd156f40b)
@@ -40,7 +40,10 @@
 #include <fibril_synch.h>
 #include <usb/usb.h>
+#include <atomic.h>
 
 /** Host controller side endpoint structure. */
 typedef struct endpoint {
+	/** Reference count. */
+	atomic_t refcnt;	
 	/** Part of linked list. */
 	link_t link;
@@ -91,4 +94,7 @@
 void endpoint_destroy(endpoint_t *instance);
 
+void endpoint_add_ref(endpoint_t *instance);
+void endpoint_del_ref(endpoint_t *instance);
+
 void endpoint_set_hc_data(endpoint_t *instance,
     void *data, int (*toggle_get)(void *), void (*toggle_set)(void *, int));
Index: uspace/lib/usbhost/src/endpoint.c
===================================================================
--- uspace/lib/usbhost/src/endpoint.c	(revision e6576355a3cebfb1925a5a55ba5aa821db40fac2)
+++ uspace/lib/usbhost/src/endpoint.c	(revision db4c43e127e6198b20ef344ad44fdf6dd156f40b)
@@ -26,4 +26,5 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 /** @addtogroup libusbhost
  * @{
@@ -37,4 +38,5 @@
 #include <assert.h>
 #include <stdlib.h>
+#include <atomic.h>
 
 /** Allocate ad initialize endpoint_t structure.
@@ -55,4 +57,5 @@
 	endpoint_t *instance = malloc(sizeof(endpoint_t));
 	if (instance) {
+		atomic_set(&instance->refcnt, 0);
 		instance->address = address;
 		instance->endpoint = endpoint;
@@ -83,8 +86,18 @@
 {
 	assert(instance);
-	//TODO: Do something about waiting fibrils.
 	assert(!instance->active);
 	assert(instance->hc_data.data == NULL);
 	free(instance);
+}
+
+void endpoint_add_ref(endpoint_t *instance)
+{
+	atomic_inc(&instance->refcnt);
+}
+
+void endpoint_del_ref(endpoint_t *instance)
+{
+	if (atomic_predec(&instance->refcnt) == 0)
+		endpoint_destroy(instance);
 }
 
@@ -122,4 +135,6 @@
 {
 	assert(instance);
+	/* Add reference for active endpoint. */
+	endpoint_add_ref(instance);
 	fibril_mutex_lock(&instance->guard);
 	while (instance->active)
@@ -139,4 +154,6 @@
 	fibril_mutex_unlock(&instance->guard);
 	fibril_condvar_signal(&instance->avail);
+	/* Drop reference for active endpoint. */
+	endpoint_del_ref(instance);
 }
 
@@ -171,4 +188,5 @@
 	fibril_mutex_unlock(&instance->guard);
 }
+
 /**
  * @}
Index: uspace/lib/usbhost/src/hcd.c
===================================================================
--- uspace/lib/usbhost/src/hcd.c	(revision e6576355a3cebfb1925a5a55ba5aa821db40fac2)
+++ uspace/lib/usbhost/src/hcd.c	(revision db4c43e127e6198b20ef344ad44fdf6dd156f40b)
@@ -241,4 +241,7 @@
 		usb_transfer_batch_destroy(batch);
 
+	/* Drop our own reference to ep. */
+	endpoint_del_ref(ep);
+
 	return ret;
 }
Index: uspace/lib/usbhost/src/usb_bus.c
===================================================================
--- uspace/lib/usbhost/src/usb_bus.c	(revision e6576355a3cebfb1925a5a55ba5aa821db40fac2)
+++ uspace/lib/usbhost/src/usb_bus.c	(revision db4c43e127e6198b20ef344ad44fdf6dd156f40b)
@@ -242,4 +242,6 @@
 		return EEXIST;
 	}
+	/* Add endpoint list's reference to ep. */
+	endpoint_add_ref(ep);
 	list_append(&ep->link, get_list(instance, ep->address));
 
@@ -274,4 +276,6 @@
 	    ep->endpoint, usb_str_transfer_type_short(ep->transfer_type),
 	    usb_str_direction(ep->direction));
+	/* Drop endpoint list's reference to ep. */
+	endpoint_del_ref(ep);
 	fibril_mutex_unlock(&instance->guard);
 	return EOK;
@@ -289,4 +293,8 @@
 	fibril_mutex_lock(&instance->guard);
 	endpoint_t *ep = find_locked(instance, address, endpoint, direction);
+	if (ep) {
+		/* We are exporting ep to the outside world, add reference. */
+		endpoint_add_ref(ep);
+	}
 	fibril_mutex_unlock(&instance->guard);
 	return ep;
@@ -350,16 +358,26 @@
 	}
 
+	/* Add our reference to ep. */
+	endpoint_add_ref(ep);
+
 	if (callback) {
 		const int ret = callback(ep, arg);
 		if (ret != EOK) {
 			fibril_mutex_unlock(&instance->guard);
-			endpoint_destroy(ep);
+			endpoint_del_ref(ep);
 			return ret;
 		}
 	}
+	
+	/* Add endpoint list's reference to ep. */
+	endpoint_add_ref(ep);
 	list_append(&ep->link, get_list(instance, ep->address));
 
 	instance->free_bw -= ep->bandwidth;
 	fibril_mutex_unlock(&instance->guard);
+
+	/* Drop our reference to ep. */
+	endpoint_del_ref(ep);
+
 	return EOK;
 }
@@ -392,5 +410,6 @@
 		callback(ep, arg);
 	}
-	endpoint_destroy(ep);
+	/* Drop endpoint list's reference to ep. */
+	endpoint_del_ref(ep);
 	return EOK;
 }
@@ -445,5 +464,6 @@
 			if (callback)
 				callback(ep, arg);
-			endpoint_destroy(ep);
+			/* Drop endpoint list's reference to ep. */
+			endpoint_del_ref(ep);
 		}
 	}
