Date: Wed, 21 Dec 2011 20:27:41 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r228790 - in head/usr.sbin: fwcontrol newsyslog ypserv Message-ID: <201112212027.pBLKRfPK084637@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler (ports committer) Date: Wed Dec 21 20:27:41 2011 New Revision: 228790 URL: http://svn.freebsd.org/changeset/base/228790 Log: - Remove extraneous null ptr deref checks - Fix memory leak Submitted by: Slono Slono <slonoman2011@yandex.ru> Approved by: jhb MFC after: 1 week Modified: head/usr.sbin/fwcontrol/fwcontrol.c head/usr.sbin/newsyslog/newsyslog.c head/usr.sbin/ypserv/yp_main.c Modified: head/usr.sbin/fwcontrol/fwcontrol.c ============================================================================== --- head/usr.sbin/fwcontrol/fwcontrol.c Wed Dec 21 20:23:03 2011 (r228789) +++ head/usr.sbin/fwcontrol/fwcontrol.c Wed Dec 21 20:27:41 2011 (r228790) @@ -152,8 +152,7 @@ str2node(int fd, const char *nodestr) fweui2eui64(&data->dev[i].eui, &tmpeui); if (memcmp(&eui, &tmpeui, sizeof(struct eui64)) == 0) { node = data->dev[i].dst; - if (data != NULL) - free(data); + free(data); goto gotnode; } } Modified: head/usr.sbin/newsyslog/newsyslog.c ============================================================================== --- head/usr.sbin/newsyslog/newsyslog.c Wed Dec 21 20:23:03 2011 (r228789) +++ head/usr.sbin/newsyslog/newsyslog.c Wed Dec 21 20:27:41 2011 (r228790) @@ -1946,9 +1946,10 @@ do_zipwork(struct zipwork_entry *zwork) char zresult[MAXPATHLEN]; int c; + assert(zwork != NULL); pgm_path = NULL; strlcpy(zresult, zwork->zw_fname, sizeof(zresult)); - if (zwork != NULL && zwork->zw_conf != NULL && + if (zwork->zw_conf != NULL && zwork->zw_conf->compress > COMPRESS_NONE) for (c = 1; c < COMPRESS_TYPES; c++) { if (zwork->zw_conf->compress == c) { Modified: head/usr.sbin/ypserv/yp_main.c ============================================================================== --- head/usr.sbin/ypserv/yp_main.c Wed Dec 21 20:23:03 2011 (r228789) +++ head/usr.sbin/ypserv/yp_main.c Wed Dec 21 20:27:41 2011 (r228790) @@ -256,6 +256,7 @@ create_service(const int sock, const str const struct __rpc_sockinfo *si) { int error; + char *sname; SVCXPRT *transp; struct addrinfo hints, *res, *res0; @@ -263,6 +264,7 @@ create_service(const int sock, const str struct bindaddrlistent *blep; struct netbuf svcaddr; + sname = NULL; SLIST_INIT(&sle_head); memset(&hints, 0, sizeof(hints)); memset(&svcaddr, 0, sizeof(svcaddr)); @@ -342,7 +344,6 @@ create_service(const int sock, const str if (strncmp("0", servname, 1) == 0) { struct sockaddr *sap; socklen_t slen; - char *sname; sname = malloc(NI_MAXSERV); if (sname == NULL) { @@ -362,6 +363,7 @@ create_service(const int sock, const str strerror(errno)); freeaddrinfo(res0); close(s); + free(sname); return -1; } error = getnameinfo(sap, slen, @@ -373,6 +375,7 @@ create_service(const int sock, const str strerror(errno)); freeaddrinfo(res0); close(s); + free(sname); return -1; } servname = sname; @@ -441,7 +444,7 @@ create_service(const int sock, const str } /* XXX: ignore error intentionally */ rpcb_set(YPPROG, YPVERS, nconf, &svcaddr); - + free (sname); freeaddrinfo(res0); return 0; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201112212027.pBLKRfPK084637>