Module Name:    src
Committed By:   nat
Date:           Fri Feb 26 01:38:44 UTC 2021

Modified Files:
        src/sys/dev/usb: if_urtwn.c

Log Message:
Also free assocated mbufs.


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/usb/if_urtwn.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.94 src/sys/dev/usb/if_urtwn.c:1.95
--- src/sys/dev/usb/if_urtwn.c:1.94	Sun Feb 21 23:06:13 2021
+++ src/sys/dev/usb/if_urtwn.c	Fri Feb 26 01:38:44 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.94 2021/02/21 23:06:13 mrg Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.95 2021/02/26 01:38:44 nat Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.94 2021/02/21 23:06:13 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.95 2021/02/26 01:38:44 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1470,6 +1470,10 @@ urtwn_read_rom(struct urtwn_softc *sc)
 	    sc->pa_setting, sc->board_type, sc->regulatory, 0);
 
 	IEEE80211_ADDR_COPY(ic->ic_myaddr, rom->macaddr);
+#if 0
+	uint8_t new_myaddr[6] = {0x90,0x0a,0x1a,0xe7,0x1e,0xf0}; //Camera
+	IEEE80211_ADDR_COPY(ic->ic_myaddr, new_myaddr);
+#endif
 
 	sc->sc_rf_write = urtwn_r92c_rf_write;
 	sc->sc_power_on = urtwn_r92c_power_on;
@@ -2660,6 +2664,7 @@ urtwn_tx(struct urtwn_softc *sc, struct 
 		k = ieee80211_crypto_encap(ic, ni, m);
 		if (k == NULL) {
 			urtwn_put_tx_data(sc, data);
+			m_free(m);
 			return ENOBUFS;
 		}
 
@@ -2908,6 +2913,7 @@ urtwn_start(struct ifnet *ifp)
 		data = urtwn_get_tx_data(sc, sc->ac2idx[qid]);
 
 		if (data == NULL) {
+			m_freem(m);
 			ifp->if_flags |= IFF_OACTIVE;
 			DPRINTFN(DBG_TX, "empty tx_free_list", 0, 0, 0, 0);
 			return;
@@ -2919,16 +2925,17 @@ urtwn_start(struct ifnet *ifp)
 			device_printf(sc->sc_dev, "m_pullup failed\n");
 			if_statinc(ifp, if_oerrors);
 			urtwn_put_tx_data(sc, data);
+			m_freem(m);
 			continue;
 		}
 		eh = mtod(m, struct ether_header *);
 		ni = ieee80211_find_txnode(ic, eh->ether_dhost);
 		if (ni == NULL) {
-			m_freem(m);
 			device_printf(sc->sc_dev,
 			    "unable to find transmit node\n");
 			if_statinc(ifp, if_oerrors);
 			urtwn_put_tx_data(sc, data);
+			m_freem(m);
 			continue;
 		}
 
@@ -2940,6 +2947,7 @@ urtwn_start(struct ifnet *ifp)
 			    "unable to encapsulate packet\n");
 			if_statinc(ifp, if_oerrors);
 			urtwn_put_tx_data(sc, data);
+			m_freem(m);
 			continue;
 		}
  sendit:

Reply via email to