CVS commit: src/sys
Module Name:src Committed By: riastradh Date: Thu Jan 21 15:41:30 UTC 2016 Modified Files: src/sys/net: if.c link_proto.c rtsock.c src/sys/netatalk: at_proto.c src/sys/netbt: bt_proto.c src/sys/netinet: if_arp.c in_proto.c in_proto.h ip_icmp.c ip_input.c raw_ip.c src/sys/netinet6: icmp6.c in6_proto.c ip6protosw.h sctp6_usrreq.c src/sys/netipsec: ipsec_input.c Log Message: Revert previous: ran cvs commit when I meant cvs diff. Sorry! Hit up-arrow one too few times. To generate a diff of this commit: cvs rdiff -u -r1.321 -r1.322 src/sys/net/if.c cvs rdiff -u -r1.29 -r1.30 src/sys/net/link_proto.c cvs rdiff -u -r1.176 -r1.177 src/sys/net/rtsock.c cvs rdiff -u -r1.20 -r1.21 src/sys/netatalk/at_proto.c cvs rdiff -u -r1.15 -r1.16 src/sys/netbt/bt_proto.c cvs rdiff -u -r1.201 -r1.202 src/sys/netinet/if_arp.c cvs rdiff -u -r1.117 -r1.118 src/sys/netinet/in_proto.c cvs rdiff -u -r1.3 -r1.4 src/sys/netinet/in_proto.h cvs rdiff -u -r1.143 -r1.144 src/sys/netinet/ip_icmp.c cvs rdiff -u -r1.327 -r1.328 src/sys/netinet/ip_input.c cvs rdiff -u -r1.155 -r1.156 src/sys/netinet/raw_ip.c cvs rdiff -u -r1.178 -r1.179 src/sys/netinet6/icmp6.c cvs rdiff -u -r1.109 -r1.110 src/sys/netinet6/in6_proto.c cvs rdiff -u -r1.24 -r1.25 src/sys/netinet6/ip6protosw.h cvs rdiff -u -r1.2 -r1.3 src/sys/netinet6/sctp6_usrreq.c cvs rdiff -u -r1.34 -r1.35 src/sys/netipsec/ipsec_input.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/net/if.c diff -u src/sys/net/if.c:1.321 src/sys/net/if.c:1.322 --- src/sys/net/if.c:1.321 Thu Jan 21 15:27:48 2016 +++ src/sys/net/if.c Thu Jan 21 15:41:29 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.321 2016/01/21 15:27:48 riastradh Exp $ */ +/* $NetBSD: if.c,v 1.322 2016/01/21 15:41:29 riastradh Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.321 2016/01/21 15:27:48 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.322 2016/01/21 15:41:29 riastradh Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -745,8 +745,7 @@ if_detach(struct ifnet *ifp) #endif struct domain *dp; const struct protosw *pr; - size_t i; - int s, family, purged; + int s, i, family, purged; uint64_t xc; /* @@ -829,9 +828,8 @@ again: * ifp->if_addrlist. */ purged = 0; - for (i = 0; i < dp->dom_nprotosw; i++) { - pr = dp->dom_protosw[i]; - KASSERT(pr != NULL); + for (pr = dp->dom_protosw; + pr < dp->dom_protoswNPROTOSW; pr++) { so.so_proto = pr; if (pr->pr_usrreqs) { (void) (*pr->pr_usrreqs->pr_purgeif)(, ifp); Index: src/sys/net/link_proto.c diff -u src/sys/net/link_proto.c:1.29 src/sys/net/link_proto.c:1.30 --- src/sys/net/link_proto.c:1.29 Thu Jan 21 15:27:48 2016 +++ src/sys/net/link_proto.c Thu Jan 21 15:41:29 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: link_proto.c,v 1.29 2016/01/21 15:27:48 riastradh Exp $ */ +/* $NetBSD: link_proto.c,v 1.30 2016/01/21 15:41:29 riastradh Exp $ */ /*- * Copyright (c) 1982, 1986, 1993 @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.29 2016/01/21 15:27:48 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.30 2016/01/21 15:41:29 riastradh Exp $"); #include #include @@ -98,7 +98,7 @@ static const struct pr_usrreqs link_usrr .pr_purgeif = link_purgeif, }; -const struct protosw *const linksw[] = { +const struct protosw linksw[] = { { .pr_type = SOCK_DGRAM, .pr_domain = , .pr_protocol = 0, /* XXX */ @@ -117,7 +117,7 @@ struct domain linkdomain = { .dom_externalize = NULL, .dom_dispose = NULL, .dom_protosw = linksw, - .dom_nprotosw = __arraycount(linksw), + .dom_protoswNPROTOSW = [__arraycount(linksw)], .dom_sockaddr_cmp = sockaddr_dl_cmp }; Index: src/sys/net/rtsock.c diff -u src/sys/net/rtsock.c:1.176 src/sys/net/rtsock.c:1.177 --- src/sys/net/rtsock.c:1.176 Thu Jan 21 15:27:48 2016 +++ src/sys/net/rtsock.c Thu Jan 21 15:41:29 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rtsock.c,v 1.176 2016/01/21 15:27:48 riastradh Exp $ */ +/* $NetBSD: rtsock.c,v 1.177 2016/01/21 15:41:29 riastradh Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.176 2016/01/21 15:27:48 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.177 2016/01/21 15:41:29 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1532,7 +1532,7 @@ static const struct pr_usrreqs route_usr .pr_purgeif = COMPATNAME(route_purgeif_wrapper), }; -static const struct protosw *const COMPATNAME(route_protosw)[] = { +static const struct protosw COMPATNAME(route_protosw)[] = { { .pr_type = SOCK_RAW, .pr_domain = (routedomain), @@ -1549,7 +1549,8 @@ struct domain COMPATNAME(routedomain) = .dom_name = DOMAINNAME,
CVS commit: src/sys
Module Name:src Committed By: riastradh Date: Thu Jan 21 15:27:48 UTC 2016 Modified Files: src/sys/net: if.c link_proto.c rtsock.c src/sys/netatalk: at_proto.c src/sys/netbt: bt_proto.c src/sys/netinet: if_arp.c in_proto.c in_proto.h ip_icmp.c ip_input.c raw_ip.c src/sys/netinet6: icmp6.c in6_proto.c ip6protosw.h sctp6_usrreq.c src/sys/netipsec: ipsec_input.c Log Message: Give proper prototype to ip_output. To generate a diff of this commit: cvs rdiff -u -r1.320 -r1.321 src/sys/net/if.c cvs rdiff -u -r1.28 -r1.29 src/sys/net/link_proto.c cvs rdiff -u -r1.175 -r1.176 src/sys/net/rtsock.c cvs rdiff -u -r1.19 -r1.20 src/sys/netatalk/at_proto.c cvs rdiff -u -r1.14 -r1.15 src/sys/netbt/bt_proto.c cvs rdiff -u -r1.200 -r1.201 src/sys/netinet/if_arp.c cvs rdiff -u -r1.116 -r1.117 src/sys/netinet/in_proto.c cvs rdiff -u -r1.2 -r1.3 src/sys/netinet/in_proto.h cvs rdiff -u -r1.142 -r1.143 src/sys/netinet/ip_icmp.c cvs rdiff -u -r1.326 -r1.327 src/sys/netinet/ip_input.c cvs rdiff -u -r1.154 -r1.155 src/sys/netinet/raw_ip.c cvs rdiff -u -r1.177 -r1.178 src/sys/netinet6/icmp6.c cvs rdiff -u -r1.108 -r1.109 src/sys/netinet6/in6_proto.c cvs rdiff -u -r1.23 -r1.24 src/sys/netinet6/ip6protosw.h cvs rdiff -u -r1.1 -r1.2 src/sys/netinet6/sctp6_usrreq.c cvs rdiff -u -r1.33 -r1.34 src/sys/netipsec/ipsec_input.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/net/if.c diff -u src/sys/net/if.c:1.320 src/sys/net/if.c:1.321 --- src/sys/net/if.c:1.320 Mon Jan 4 09:08:38 2016 +++ src/sys/net/if.c Thu Jan 21 15:27:48 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: if.c,v 1.320 2016/01/04 09:08:38 ozaki-r Exp $ */ +/* $NetBSD: if.c,v 1.321 2016/01/21 15:27:48 riastradh Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.320 2016/01/04 09:08:38 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.321 2016/01/21 15:27:48 riastradh Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -745,7 +745,8 @@ if_detach(struct ifnet *ifp) #endif struct domain *dp; const struct protosw *pr; - int s, i, family, purged; + size_t i; + int s, family, purged; uint64_t xc; /* @@ -828,8 +829,9 @@ again: * ifp->if_addrlist. */ purged = 0; - for (pr = dp->dom_protosw; - pr < dp->dom_protoswNPROTOSW; pr++) { + for (i = 0; i < dp->dom_nprotosw; i++) { + pr = dp->dom_protosw[i]; + KASSERT(pr != NULL); so.so_proto = pr; if (pr->pr_usrreqs) { (void) (*pr->pr_usrreqs->pr_purgeif)(, ifp); Index: src/sys/net/link_proto.c diff -u src/sys/net/link_proto.c:1.28 src/sys/net/link_proto.c:1.29 --- src/sys/net/link_proto.c:1.28 Sat May 2 17:18:03 2015 +++ src/sys/net/link_proto.c Thu Jan 21 15:27:48 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: link_proto.c,v 1.28 2015/05/02 17:18:03 rtr Exp $ */ +/* $NetBSD: link_proto.c,v 1.29 2016/01/21 15:27:48 riastradh Exp $ */ /*- * Copyright (c) 1982, 1986, 1993 @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.28 2015/05/02 17:18:03 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.29 2016/01/21 15:27:48 riastradh Exp $"); #include #include @@ -98,7 +98,7 @@ static const struct pr_usrreqs link_usrr .pr_purgeif = link_purgeif, }; -const struct protosw linksw[] = { +const struct protosw *const linksw[] = { { .pr_type = SOCK_DGRAM, .pr_domain = , .pr_protocol = 0, /* XXX */ @@ -117,7 +117,7 @@ struct domain linkdomain = { .dom_externalize = NULL, .dom_dispose = NULL, .dom_protosw = linksw, - .dom_protoswNPROTOSW = [__arraycount(linksw)], + .dom_nprotosw = __arraycount(linksw), .dom_sockaddr_cmp = sockaddr_dl_cmp }; Index: src/sys/net/rtsock.c diff -u src/sys/net/rtsock.c:1.175 src/sys/net/rtsock.c:1.176 --- src/sys/net/rtsock.c:1.175 Wed Jan 20 21:43:59 2016 +++ src/sys/net/rtsock.c Thu Jan 21 15:27:48 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: rtsock.c,v 1.175 2016/01/20 21:43:59 riastradh Exp $ */ +/* $NetBSD: rtsock.c,v 1.176 2016/01/21 15:27:48 riastradh Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.175 2016/01/20 21:43:59 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.176 2016/01/21 15:27:48 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1532,7 +1532,7 @@ static const struct pr_usrreqs route_usr .pr_purgeif = COMPATNAME(route_purgeif_wrapper), }; -static const struct protosw COMPATNAME(route_protosw)[] = { +static const struct protosw *const COMPATNAME(route_protosw)[] = { { .pr_type = SOCK_RAW, .pr_domain = (routedomain), @@ -1549,8 +1549,7 @@ struct domain COMPATNAME(routedomain) = .dom_name = DOMAINNAME, .dom_init = COMPATNAME(route_init), .dom_protosw = COMPATNAME(route_protosw), -
CVS commit: src/sys/arch/mipsco/stand/installboot
Module Name:src Committed By: christos Date: Thu Jan 21 16:58:36 UTC 2016 Modified Files: src/sys/arch/mipsco/stand/installboot: installboot.c Log Message: PR/50683: David Binderman: Fix memory leak. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mipsco/stand/installboot/installboot.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/arch/mipsco/stand/installboot/installboot.c diff -u src/sys/arch/mipsco/stand/installboot/installboot.c:1.9 src/sys/arch/mipsco/stand/installboot/installboot.c:1.10 --- src/sys/arch/mipsco/stand/installboot/installboot.c:1.9 Thu Jun 27 17:23:21 2013 +++ src/sys/arch/mipsco/stand/installboot/installboot.c Thu Jan 21 11:58:36 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: installboot.c,v 1.9 2013/06/27 21:23:21 christos Exp $ */ +/* $NetBSD: installboot.c,v 1.10 2016/01/21 16:58:36 christos Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -208,6 +208,7 @@ do_install(const char *disk, const char if (nowrite) { if (verbose) fprintf(stderr, "not writing\n"); + free(boot_code); return; }
CVS commit: src/sys/dev/stbi
Module Name:src Committed By: christos Date: Thu Jan 21 17:16:48 UTC 2016 Modified Files: src/sys/dev/stbi: stb_image.c Log Message: remove malloc casts. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/stbi/stb_image.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/stbi/stb_image.c diff -u src/sys/dev/stbi/stb_image.c:1.6 src/sys/dev/stbi/stb_image.c:1.7 --- src/sys/dev/stbi/stb_image.c:1.6 Sun Sep 15 10:06:10 2013 +++ src/sys/dev/stbi/stb_image.c Thu Jan 21 12:16:48 2016 @@ -430,7 +430,7 @@ extern int stbi_gif_info_from_file #endif #ifdef _KERNEL #include -__KERNEL_RCSID(0, "$NetBSD: stb_image.c,v 1.6 2013/09/15 14:06:10 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: stb_image.c,v 1.7 2016/01/21 17:16:48 christos Exp $"); #include #include #include @@ -985,7 +985,7 @@ static unsigned char *convert_format(uns if (req_comp == img_n) return data; assert(req_comp >= 1 && req_comp <= 4); - good = (unsigned char *) MALLOC(req_comp * x * y); + good = MALLOC(req_comp * x * y); if (good == NULL) { FREE(data); return epuc("outofmem", "Out of memory"); @@ -1025,7 +1025,7 @@ static unsigned char *convert_format(uns static float *ldr_to_hdr(stbi_uc *data, int x, int y, int comp) { int i,k,n; - float *output = (float *) MALLOC(x * y * comp * sizeof(float)); + float *output = MALLOC(x * y * comp * sizeof(float)); if (output == NULL) { FREE(data); return epf("outofmem", "Out of memory"); } // compute number of non-alpha components if (comp & 1) n = comp; else n = comp-1; @@ -1043,7 +1043,7 @@ static float *ldr_to_hdr(stbi_uc *data static stbi_uc *hdr_to_ldr(float *data, int x, int y, int comp) { int i,k,n; - stbi_uc *output = (stbi_uc *) MALLOC(x * y * comp); + stbi_uc *output = MALLOC(x * y * comp); if (output == NULL) { FREE(data); return epuc("outofmem", "Out of memory"); } // compute number of non-alpha components if (comp & 1) n = comp; else n = comp-1; @@ -1983,7 +1983,7 @@ static uint8 *load_jpeg_image(jpeg *z, i // allocate line buffer big enough for upsampling off the edges // with upsample factor of 4 - z->img_comp[k].linebuf = (uint8 *) MALLOC(z->s.img_x + 3); + z->img_comp[k].linebuf = MALLOC(z->s.img_x + 3); if (!z->img_comp[k].linebuf) { cleanup_jpeg(z); return epuc("outofmem", "Out of memory"); } r->hs = z->img_h_max / z->img_comp[k].h; @@ -2001,7 +2001,7 @@ static uint8 *load_jpeg_image(jpeg *z, i } // can't error after this so, this is safe - output = (uint8 *) MALLOC(n * z->s.img_x * z->s.img_y + 1); + output = MALLOC(n * z->s.img_x * z->s.img_y + 1); if (!output) { cleanup_jpeg(z); return epuc("outofmem", "Out of memory"); } // now go ahead and resample @@ -2074,7 +2074,7 @@ unsigned char *stbi_jpeg_load_from_memor { #ifdef STBI_SMALL_STACK unsigned char *result; - jpeg *j = (jpeg *) MALLOC(sizeof(*j)); + jpeg *j = MALLOC(sizeof(*j)); start_mem(>s, buffer, len); result = load_jpeg_image(j,x,y,comp,req_comp); FREE(j); @@ -2512,7 +2512,7 @@ static int do_zlib(zbuf *a, char *obuf, char *stbi_zlib_decode_malloc_guesssize(const char * buffer, int len, int initial_size, int *outlen) { zbuf a; - char *p = (char *) MALLOC(initial_size); + char *p = MALLOC(initial_size); if (p == NULL) return NULL; a.zbuffer = (uint8 const *) buffer; a.zbuffer_end = (uint8 const *) buffer + len; @@ -2533,7 +2533,7 @@ char *stbi_zlib_decode_malloc(char const char *stbi_zlib_decode_malloc_guesssize_headerflag(const char *buffer, int len, int initial_size, int *outlen, int parse_header) { zbuf a; - char *p = (char *) MALLOC(initial_size); + char *p = MALLOC(initial_size); if (p == NULL) return NULL; a.zbuffer = (uint8 const *) buffer; a.zbuffer_end = (uint8 const *) buffer + len; @@ -2560,7 +2560,7 @@ int stbi_zlib_decode_buffer(char *obuffe char *stbi_zlib_decode_noheader_malloc(char const *buffer, int len, int *outlen) { zbuf a; - char *p = (char *) MALLOC(16384); + char *p = MALLOC(16384); if (p == NULL) return NULL; a.zbuffer = (uint8 const *) buffer; a.zbuffer_end = (uint8 const *) buffer+len; @@ -2657,7 +2657,7 @@ static int create_png_image_raw(png *a, int img_n = s->img_n; // copy it into a local for later assert(out_n == s->img_n || out_n == s->img_n+1); if (stbi_png_partial) y = 1; - a->out = (uint8 *) MALLOC(x * y * out_n); + a->out = MALLOC(x * y * out_n); if (!a->out) return e("outofmem", "Out of memory"); if (!stbi_png_partial) { if (s->img_x == x && s->img_y == y) { @@ -2737,7 +2737,7 @@ static int create_png_image(png *a, uint stbi_png_partial = 0; // de-interlacing - final = (uint8 *) MALLOC(a->s.img_x * a->s.img_y * out_n); +
CVS commit: src/sys/arch/hppa/stand/mkboot
Module Name:src Committed By: christos Date: Thu Jan 21 17:00:23 UTC 2016 Modified Files: src/sys/arch/hppa/stand/mkboot: mkboot.c Log Message: PR/50684: David Binderman: Fix memory leak To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/hppa/stand/mkboot/mkboot.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/arch/hppa/stand/mkboot/mkboot.c diff -u src/sys/arch/hppa/stand/mkboot/mkboot.c:1.1 src/sys/arch/hppa/stand/mkboot/mkboot.c:1.2 --- src/sys/arch/hppa/stand/mkboot/mkboot.c:1.1 Mon Feb 24 02:23:43 2014 +++ src/sys/arch/hppa/stand/mkboot/mkboot.c Thu Jan 21 12:00:23 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mkboot.c,v 1.1 2014/02/24 07:23:43 skrll Exp $ */ +/* $NetBSD: mkboot.c,v 1.2 2016/01/21 17:00:23 christos Exp $ */ /* $OpenBSD: mkboot.c,v 1.9 2001/05/17 00:57:55 pvalchev Exp $ */ @@ -234,7 +234,7 @@ putfile(char *from_file, int to) int from, check_sum = 0; struct hppa_lifload load; Elf32_External_Ehdr elf_header; - Elf32_External_Phdr *elf_segments; + Elf32_External_Phdr *elf_segments = NULL; int i, header_count, memory_needed, elf_load_image_segment; if ((from = open(from_file, O_RDONLY)) < 0) @@ -356,6 +356,7 @@ putfile(char *from_file, int to) if (close(from) < 0) err(1, "%s", from_file); + free(elf_segments); return total; }
CVS commit: src/sys/arch/powerpc/stand/mkbootimage
Module Name:src Committed By: christos Date: Thu Jan 21 17:14:05 UTC 2016 Modified Files: src/sys/arch/powerpc/stand/mkbootimage: mkbootimage.c Log Message: PR/50685: David Binderman: fix memory leak To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 \ src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.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/arch/powerpc/stand/mkbootimage/mkbootimage.c diff -u src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c:1.18 src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c:1.19 --- src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c:1.18 Tue Apr 22 17:37:52 2014 +++ src/sys/arch/powerpc/stand/mkbootimage/mkbootimage.c Thu Jan 21 12:14:05 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: mkbootimage.c,v 1.18 2014/04/22 21:37:52 phx Exp $ */ +/* $NetBSD: mkbootimage.c,v 1.19 2016/01/21 17:14:05 christos Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -336,7 +336,7 @@ prep_build_image(char *kernel, char *boo lseek(prep_fd, 0x400, SEEK_SET); /* Copy boot image */ - elf_img = (unsigned char *)malloc(elf_img_len); + elf_img = malloc(elf_img_len); if (!elf_img) errx(3, "Can't malloc: %s", strerror(errno)); if (read(elf_fd, elf_img, elf_img_len) != elf_img_len) @@ -347,7 +347,7 @@ prep_build_image(char *kernel, char *boo if (inkernflag) { /* Copy kernel */ - kern_img = (unsigned char *)malloc(kern_stat.st_size); + kern_img = malloc(kern_stat.st_size); if (kern_img == NULL) errx(3, "Can't malloc: %s", strerror(errno)); @@ -502,7 +502,7 @@ rs6000_build_image(char *kernel, char *b lseek(rs6000_fd, 0x400, SEEK_SET); /* Copy boot image */ - elf_img = (unsigned char *)malloc(elf_img_len); + elf_img = malloc(elf_img_len); if (!elf_img) errx(3, "Can't malloc: %s", strerror(errno)); if (read(elf_fd, elf_img, elf_img_len) != elf_img_len) @@ -516,7 +516,7 @@ rs6000_build_image(char *kernel, char *b lseek(rs6000_fd, elf_pad, SEEK_CUR); /* Copy kernel */ - kern_img = (unsigned char *)malloc(kern_stat.st_size); + kern_img = malloc(kern_stat.st_size); if (kern_img == NULL) errx(3, "Can't malloc: %s", strerror(errno)); @@ -735,7 +735,7 @@ bebox_build_image(char *kernel, char *bo bebox_write_header(bebox_fd, elf_img_len, kern_stat.st_size); /* Copy kernel */ - kern_img = (unsigned char *)malloc(kern_stat.st_size); + kern_img = malloc(kern_stat.st_size); if (kern_img == NULL) errx(3, "Can't malloc: %s", strerror(errno)); @@ -786,7 +786,7 @@ bebox_build_image(char *kernel, char *bo toff = bebox_write_header(bebox_fd, elf_img_len, tmp); /* Copy boot image */ - elf_img = (unsigned char *)malloc(elf_img_len); + elf_img = malloc(elf_img_len); if (!elf_img) errx(3, "Can't malloc: %s", strerror(errno)); if (read(elf_fd, elf_img, elf_img_len) != elf_img_len) @@ -802,7 +802,7 @@ bebox_build_image(char *kernel, char *bo /* Now go back and write in the block header */ endoff = lseek(bebox_fd, 0, SEEK_END); lseek(bebox_fd, 0, SEEK_SET); - header_img = (unsigned char *)malloc(BEBOX_HEADER_SIZE); + header_img = malloc(BEBOX_HEADER_SIZE); if (!header_img) errx(3, "Can't malloc: %s", strerror(errno)); memset(header_img, 0, BEBOX_HEADER_SIZE); @@ -837,6 +837,7 @@ bebox_build_image(char *kernel, char *bo write(bebox_fd, header_img, flength - endoff); close(bebox_fd); + free(header_img); return 0; }
CVS commit: src/sys/dev/stbi
Module Name:src Committed By: christos Date: Thu Jan 21 17:17:53 UTC 2016 Modified Files: src/sys/dev/stbi: stb_image.c Log Message: PR/50686: David Binderman: fix memory leak To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/stbi/stb_image.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/stbi/stb_image.c diff -u src/sys/dev/stbi/stb_image.c:1.7 src/sys/dev/stbi/stb_image.c:1.8 --- src/sys/dev/stbi/stb_image.c:1.7 Thu Jan 21 12:16:48 2016 +++ src/sys/dev/stbi/stb_image.c Thu Jan 21 12:17:53 2016 @@ -430,7 +430,7 @@ extern int stbi_gif_info_from_file #endif #ifdef _KERNEL #include -__KERNEL_RCSID(0, "$NetBSD: stb_image.c,v 1.7 2016/01/21 17:16:48 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: stb_image.c,v 1.8 2016/01/21 17:17:53 christos Exp $"); #include #include #include @@ -3358,7 +3358,10 @@ static stbi_uc *bmp_load(stbi *s, int *x easy = 2; } if (!easy) { - if (!mr || !mg || !mb) return epuc("bad masks", "Corrupt BMP"); + if (!mr || !mg || !mb) { + FREE(out); + return epuc("bad masks", "Corrupt BMP"); + } // right shift amt to put high bit in position #7 rshift = high_bit(mr)-7; rcount = bitcount(mr); gshift = high_bit(mg)-7; gcount = bitcount(mr);
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: ozaki-r Date: Fri Jan 22 04:26:01 UTC 2016 Modified Files: src/sys/rump/librump/rumpkern: emul.c Log Message: Fix build with RUMP_LOCKDEBUG=yes To generate a diff of this commit: cvs rdiff -u -r1.177 -r1.178 src/sys/rump/librump/rumpkern/emul.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/rump/librump/rumpkern/emul.c diff -u src/sys/rump/librump/rumpkern/emul.c:1.177 src/sys/rump/librump/rumpkern/emul.c:1.178 --- src/sys/rump/librump/rumpkern/emul.c:1.177 Mon Jan 18 23:27:20 2016 +++ src/sys/rump/librump/rumpkern/emul.c Fri Jan 22 04:26:01 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: emul.c,v 1.177 2016/01/18 23:27:20 pooka Exp $ */ +/* $NetBSD: emul.c,v 1.178 2016/01/22 04:26:01 ozaki-r Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.177 2016/01/18 23:27:20 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.178 2016/01/22 04:26:01 ozaki-r Exp $"); #include #include @@ -35,6 +35,9 @@ __KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.1 #include #include #include +#ifdef LOCKDEBUG +#include +#endif #include
CVS commit: src/sys/dev/ic
Module Name:src Committed By: ozaki-r Date: Fri Jan 22 06:51:47 UTC 2016 Modified Files: src/sys/dev/ic: midway.c Log Message: Revert previous atm_input is not compatible with ifp->if_input and other *_input routines... To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/dev/ic/midway.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/ic/midway.c diff -u src/sys/dev/ic/midway.c:1.95 src/sys/dev/ic/midway.c:1.96 --- src/sys/dev/ic/midway.c:1.95 Fri Jan 22 06:34:59 2016 +++ src/sys/dev/ic/midway.c Fri Jan 22 06:51:47 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: midway.c,v 1.95 2016/01/22 06:34:59 ozaki-r Exp $ */ +/* $NetBSD: midway.c,v 1.96 2016/01/22 06:51:47 ozaki-r Exp $ */ /* (sync'd to midway.c 1.68) */ /* @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.95 2016/01/22 06:34:59 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.96 2016/01/22 06:51:47 ozaki-r Exp $"); #include "opt_natm.h" @@ -2768,7 +2768,7 @@ EN_INTR_TYPE en_intr(void *arg) bpf_mtap(ifp, m); - ifp->if_input(ifp, , m, sc->rxslot[slot].rxhand); + atm_input(ifp, , m, sc->rxslot[slot].rxhand); } }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: ozaki-r Date: Fri Jan 22 06:34:59 UTC 2016 Modified Files: src/sys/dev/ic: midway.c Log Message: Don't call atm_input directly This should be the last one that was survived ifp->if_input replacements. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/dev/ic/midway.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/ic/midway.c diff -u src/sys/dev/ic/midway.c:1.94 src/sys/dev/ic/midway.c:1.95 --- src/sys/dev/ic/midway.c:1.94 Tue Mar 13 18:40:31 2012 +++ src/sys/dev/ic/midway.c Fri Jan 22 06:34:59 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: midway.c,v 1.94 2012/03/13 18:40:31 elad Exp $ */ +/* $NetBSD: midway.c,v 1.95 2016/01/22 06:34:59 ozaki-r Exp $ */ /* (sync'd to midway.c 1.68) */ /* @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.94 2012/03/13 18:40:31 elad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: midway.c,v 1.95 2016/01/22 06:34:59 ozaki-r Exp $"); #include "opt_natm.h" @@ -2768,7 +2768,7 @@ EN_INTR_TYPE en_intr(void *arg) bpf_mtap(ifp, m); - atm_input(ifp, , m, sc->rxslot[slot].rxhand); + ifp->if_input(ifp, , m, sc->rxslot[slot].rxhand); } }