Sat Oct 15 08:37:55 2016 UTC ()
There are several leaks in here, just fix one that should have been fixed
in rev1.21


(maxv)
diff -r1.21 -r1.22 src/sys/dev/if_ndis/if_ndis_pci.c

cvs diff -r1.21 -r1.22 src/sys/dev/if_ndis/Attic/if_ndis_pci.c (expand / switch to unified diff)

--- src/sys/dev/if_ndis/Attic/if_ndis_pci.c 2015/04/04 15:22:02 1.21
+++ src/sys/dev/if_ndis/Attic/if_ndis_pci.c 2016/10/15 08:37:55 1.22
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 23 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE. 30 * THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.21 2015/04/04 15:22:02 christos Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: if_ndis_pci.c,v 1.22 2016/10/15 08:37:55 maxv Exp $");
35#ifdef __FreeBSD__ 35#ifdef __FreeBSD__
36__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.8.2.3 2005/03/31 04:24:36 wpaul Exp $"); 36__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.8.2.3 2005/03/31 04:24:36 wpaul Exp $");
37#endif 37#endif
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/kernel.h> 41#include <sys/kernel.h>
42#include <sys/module.h> 42#include <sys/module.h>
43#include <sys/socket.h> 43#include <sys/socket.h>
44#include <sys/queue.h> 44#include <sys/queue.h>
45#include <sys/sysctl.h> 45#include <sys/sysctl.h>
46 46
47#include <net/if.h> 47#include <net/if.h>
@@ -290,27 +290,27 @@ void ndis_attach_pci(device_t parent, de @@ -290,27 +290,27 @@ void ndis_attach_pci(device_t parent, de
290 prd->u.cprd_mem.cprd_start.np_quad = (uint64_t)base; 290 prd->u.cprd_mem.cprd_start.np_quad = (uint64_t)base;
291 prd->u.cprd_mem.cprd_len = (uint32_t)size; 291 prd->u.cprd_mem.cprd_len = (uint32_t)size;
292  292
293 if(sc->ndis_res_mem != NULL &&  293 if(sc->ndis_res_mem != NULL &&
294 sc->ndis_res_altmem != NULL) { 294 sc->ndis_res_altmem != NULL) {
295 printf("too many resources\n"); 295 printf("too many resources\n");
296 sc->error = ENXIO; 296 sc->error = ENXIO;
297 goto out; 297 goto out;
298 } 298 }
299 if(sc->ndis_res_mem) { 299 if(sc->ndis_res_mem) {
300 if((sc->ndis_res_altmem =  300 if((sc->ndis_res_altmem =
301 malloc(sizeof(struct ndis_resource), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { 301 malloc(sizeof(struct ndis_resource), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) {
302 sc->error = ENOMEM; 302 sc->error = ENOMEM;
303 return; 303 goto out;
304 } 304 }
305 sc->ndis_res_altmem->res_base = base; 305 sc->ndis_res_altmem->res_base = base;
306 sc->ndis_res_altmem->res_size = size; 306 sc->ndis_res_altmem->res_size = size;
307 sc->ndis_res_altmem->res_tag = x86_bus_space_mem; 307 sc->ndis_res_altmem->res_tag = x86_bus_space_mem;
308  308
309  309
310 if(bus_space_map(sc->ndis_res_altmem->res_tag, 310 if(bus_space_map(sc->ndis_res_altmem->res_tag,
311 sc->ndis_res_altmem->res_base, 311 sc->ndis_res_altmem->res_base,
312 sc->ndis_res_altmem->res_size, 312 sc->ndis_res_altmem->res_size,
313 flags|BUS_SPACE_MAP_LINEAR, 313 flags|BUS_SPACE_MAP_LINEAR,
314 &sc->ndis_res_altmem->res_handle)) { 314 &sc->ndis_res_altmem->res_handle)) {
315 printf("bus_space_map failed\n"); 315 printf("bus_space_map failed\n");
316 } 316 }