There will probably be more similar patches to come if this is acceptable. The legwork was done with the following Coccinelle script:
@@ expression E; @@ - if(E) { - free(E); - } + free(E); Index: bin/systrace/filter.c =================================================================== RCS file: /cvs/src/bin/systrace/filter.c,v retrieving revision 1.36 diff -u -p -r1.36 filter.c --- bin/systrace/filter.c 18 Apr 2015 18:28:37 -0000 1.36 +++ bin/systrace/filter.c 9 Sep 2015 15:38:47 -0000 @@ -216,10 +216,8 @@ logic_free(struct logic *logic) logic_free(logic->left); if (logic->right) logic_free(logic->right); - if (logic->type) - free(logic->type); - if (logic->filterdata) - free(logic->filterdata); + free(logic->type); + free(logic->filterdata); free(logic); } @@ -228,8 +226,7 @@ filter_free(struct filter *filter) { if (filter->logicroot) logic_free(filter->logicroot); - if (filter->rule) - free(filter->rule); + free(filter->rule); free(filter); } Index: bin/systrace/intercept-translate.c =================================================================== RCS file: /cvs/src/bin/systrace/intercept-translate.c,v retrieving revision 1.17 diff -u -p -r1.17 intercept-translate.c --- bin/systrace/intercept-translate.c 10 Aug 2014 04:57:33 -0000 1.17 +++ bin/systrace/intercept-translate.c 9 Sep 2015 15:38:47 -0000 @@ -56,10 +56,8 @@ static int ic_print_sockaddr(char *, siz static void ic_trans_free(struct intercept_translate *trans) { - if (trans->trans_data) - free(trans->trans_data); - if (trans->trans_print) - free(trans->trans_print); + free(trans->trans_data); + free(trans->trans_print); trans->trans_valid = 0; trans->trans_data = NULL; trans->trans_print = NULL; Index: bin/systrace/intercept.c =================================================================== RCS file: /cvs/src/bin/systrace/intercept.c,v retrieving revision 1.63 diff -u -p -r1.63 intercept.c --- bin/systrace/intercept.c 16 Jan 2015 00:19:12 -0000 1.63 +++ bin/systrace/intercept.c 9 Sep 2015 15:38:47 -0000 @@ -402,10 +402,8 @@ intercept_freepid(pid_t pidnr) intercept.freepid(pid); SPLAY_REMOVE(pidtree, &pids, pid); - if (pid->name) - free(pid->name); - if (pid->newname) - free(pid->newname); + free(pid->name); + free(pid->newname); free(pid); } @@ -786,8 +784,7 @@ intercept_syscall(int fd, pid_t pid, u_i icpid->execve_code = code; icpid->policynr = policynr; - if (icpid->newname) - free(icpid->newname); + free(icpid->newname); intercept.getarg(0, args, argsize, &addr); argname = intercept_filename(fd, pid, addr, ICLINK_ALL, before); @@ -887,8 +884,7 @@ intercept_newimage(int fd, pid_t pid, in if (icpid == NULL) icpid = intercept_getpid(pid); - if (icpid->name) - free(icpid->name); + free(icpid->name); if ((icpid->name = strdup(newname)) == NULL) err(1, "%s:%d: strdup", __func__, __LINE__); Index: games/hack/hack.do_name.c =================================================================== RCS file: /cvs/src/games/hack/hack.do_name.c,v retrieving revision 1.10 diff -u -p -r1.10 hack.do_name.c --- games/hack/hack.do_name.c 11 Mar 2014 08:05:15 -0000 1.10 +++ games/hack/hack.do_name.c 9 Sep 2015 15:38:47 -0000 @@ -246,7 +246,7 @@ docall(struct obj *obj) str = newstring(len); (void) strlcpy(str, buf, len); str1 = &(objects[obj->otyp].oc_uname); - if(*str1) free(*str1); + free(*str1); *str1 = str; } Index: lib/libc/asr/asr.c =================================================================== RCS file: /cvs/src/lib/libc/asr/asr.c,v retrieving revision 1.39 diff -u -p -r1.39 asr.c --- lib/libc/asr/asr.c 2 Sep 2015 13:47:47 -0000 1.39 +++ lib/libc/asr/asr.c 9 Sep 2015 15:38:51 -0000 @@ -276,40 +276,34 @@ asr_async_free(struct asr_query *as) close(as->as_fd); if (as->as.dns.obuf && !(as->as.dns.flags & ASYNC_EXTOBUF)) free(as->as.dns.obuf); - if (as->as.dns.ibuf) - free(as->as.dns.ibuf); - if (as->as.dns.dname) - free(as->as.dns.dname); + free(as->as.dns.ibuf); + free(as->as.dns.dname); break; case ASR_SEARCH: if (as->as.search.subq) asr_async_free(as->as.search.subq); - if (as->as.search.name) - free(as->as.search.name); + free(as->as.search.name); break; case ASR_GETRRSETBYNAME: if (as->as.rrset.subq) asr_async_free(as->as.rrset.subq); - if (as->as.rrset.name) - free(as->as.rrset.name); + free(as->as.rrset.name); break; case ASR_GETHOSTBYNAME: case ASR_GETHOSTBYADDR: if (as->as.hostnamadr.subq) asr_async_free(as->as.hostnamadr.subq); - if (as->as.hostnamadr.name) - free(as->as.hostnamadr.name); + free(as->as.hostnamadr.name); break; case ASR_GETNETBYNAME: case ASR_GETNETBYADDR: if (as->as.netnamadr.subq) asr_async_free(as->as.netnamadr.subq); - if (as->as.netnamadr.name) - free(as->as.netnamadr.name); + free(as->as.netnamadr.name); break; case ASR_GETADDRINFO: @@ -317,12 +311,9 @@ asr_async_free(struct asr_query *as) asr_async_free(as->as.ai.subq); if (as->as.ai.aifirst) freeaddrinfo(as->as.ai.aifirst); - if (as->as.ai.hostname) - free(as->as.ai.hostname); - if (as->as.ai.servname) - free(as->as.ai.servname); - if (as->as.ai.fqdn) - free(as->as.ai.fqdn); + free(as->as.ai.hostname); + free(as->as.ai.servname); + free(as->as.ai.fqdn); break; case ASR_GETNAMEINFO: @@ -392,8 +383,7 @@ asr_ctx_free(struct asr_ctx *ac) { int i; - if (ac->ac_domain) - free(ac->ac_domain); + free(ac->ac_domain); for (i = 0; i < ASR_MAXNS; i++) free(ac->ac_ns[i]); for (i = 0; i < ASR_MAXDOM; i++) Index: lib/libc/asr/gethostnamadr_async.c =================================================================== RCS file: /cvs/src/lib/libc/asr/gethostnamadr_async.c,v retrieving revision 1.37 diff -u -p -r1.37 gethostnamadr_async.c --- lib/libc/asr/gethostnamadr_async.c 29 May 2015 08:49:37 -0000 1.37 +++ lib/libc/asr/gethostnamadr_async.c 9 Sep 2015 15:38:51 -0000 @@ -681,8 +681,7 @@ _yp_gethostnamadr(int type, const void * } else { errno = 0; /* ignore error if not found */ } - if (res) - free(res); + free(res); return (h); } Index: lib/libc/asr/getrrsetbyname.c =================================================================== RCS file: /cvs/src/lib/libc/asr/getrrsetbyname.c,v retrieving revision 1.5 diff -u -p -r1.5 getrrsetbyname.c --- lib/libc/asr/getrrsetbyname.c 26 Mar 2014 18:13:15 -0000 1.5 +++ lib/libc/asr/getrrsetbyname.c 9 Sep 2015 15:38:51 -0000 @@ -76,7 +76,6 @@ freerrset(struct rrsetinfo *rrset) free(rrset->rri_sigs); } - if (rrset->rri_name) - free(rrset->rri_name); + free(rrset->rri_name); free(rrset); } Index: lib/libc/asr/getrrsetbyname_async.c =================================================================== RCS file: /cvs/src/lib/libc/asr/getrrsetbyname_async.c,v retrieving revision 1.7 diff -u -p -r1.7 getrrsetbyname_async.c --- lib/libc/asr/getrrsetbyname_async.c 26 Mar 2014 18:13:15 -0000 1.7 +++ lib/libc/asr/getrrsetbyname_async.c 9 Sep 2015 15:38:51 -0000 @@ -540,8 +540,7 @@ free_dns_query(struct dns_query *p) if (p == NULL) return; - if (p->name) - free(p->name); + free(p->name); free_dns_query(p->next); free(p); } @@ -552,10 +551,8 @@ free_dns_rr(struct dns_rr *p) if (p == NULL) return; - if (p->name) - free(p->name); - if (p->rdata) - free(p->rdata); + free(p->name); + free(p->rdata); free_dns_rr(p->next); free(p); } Index: lib/libc/asr/res_send_async.c =================================================================== RCS file: /cvs/src/lib/libc/asr/res_send_async.c,v retrieving revision 1.23 diff -u -p -r1.23 res_send_async.c --- lib/libc/asr/res_send_async.c 20 Jun 2015 01:16:25 -0000 1.23 +++ lib/libc/asr/res_send_async.c 9 Sep 2015 15:38:51 -0000 @@ -397,8 +397,7 @@ setup_query(struct asr_query *as, const as->as.dns.reqid = h.id; as->as.dns.type = type; as->as.dns.class = class; - if (as->as.dns.dname) - free(as->as.dns.dname); + free(as->as.dns.dname); as->as.dns.dname = strdup(dname); if (as->as.dns.dname == NULL) { DPRINT("strdup"); Index: lib/libc/db/btree/bt_open.c =================================================================== RCS file: /cvs/src/lib/libc/db/btree/bt_open.c,v retrieving revision 1.18 diff -u -p -r1.18 bt_open.c --- lib/libc/db/btree/bt_open.c 15 Sep 2014 06:12:19 -0000 1.18 +++ lib/libc/db/btree/bt_open.c 9 Sep 2015 15:38:51 -0000 @@ -318,8 +318,7 @@ eftype: errno = EFTYPE; err: saved_errno = errno; if (t) { - if (t->bt_dbp) - free(t->bt_dbp); + free(t->bt_dbp); if (t->bt_fd != -1) (void)close(t->bt_fd); free(t); Index: lib/libc/db/hash/hash.c =================================================================== RCS file: /cvs/src/lib/libc/db/hash/hash.c,v retrieving revision 1.26 diff -u -p -r1.26 hash.c --- lib/libc/db/hash/hash.c 16 Jan 2015 16:48:51 -0000 1.26 +++ lib/libc/db/hash/hash.c 9 Sep 2015 15:38:51 -0000 @@ -408,12 +408,9 @@ hdestroy(HTAB *hashp) save_errno = errno; /* Free Bigmaps */ for (i = 0; i < hashp->nmaps; i++) - if (hashp->mapp[i]) - free(hashp->mapp[i]); - if (hashp->tmp_key) - free(hashp->tmp_key); - if (hashp->tmp_buf) - free(hashp->tmp_buf); + free(hashp->mapp[i]); + free(hashp->tmp_key); + free(hashp->tmp_buf); if (hashp->fp != -1) (void)close(hashp->fp); Index: lib/libc/db/hash/hash_bigkey.c =================================================================== RCS file: /cvs/src/lib/libc/db/hash/hash_bigkey.c,v retrieving revision 1.18 diff -u -p -r1.18 hash_bigkey.c --- lib/libc/db/hash/hash_bigkey.c 16 Jan 2015 16:48:51 -0000 1.18 +++ lib/libc/db/hash/hash_bigkey.c 9 Sep 2015 15:38:51 -0000 @@ -452,8 +452,7 @@ collect_data(HTAB *hashp, BUFHEAD *bufp, if (bp[2] == FULL_KEY_DATA) { /* End of Data */ totlen = len + mylen; - if (hashp->tmp_buf) - free(hashp->tmp_buf); + free(hashp->tmp_buf); if ((hashp->tmp_buf = (char *)malloc(totlen)) == NULL) return (-1); if (set) { Index: lib/libc/gen/auth_subr.c =================================================================== RCS file: /cvs/src/lib/libc/gen/auth_subr.c,v retrieving revision 1.43 diff -u -p -r1.43 auth_subr.c --- lib/libc/gen/auth_subr.c 3 Sep 2015 04:27:49 -0000 1.43 +++ lib/libc/gen/auth_subr.c 9 Sep 2015 15:38:51 -0000 @@ -278,14 +278,10 @@ auth_close(auth_session_t *as) */ if (as->service && as->service != defservice) free(as->service); - if (as->challenge) - free(as->challenge); - if (as->class) - free(as->class); - if (as->style) - free(as->style); - if (as->name) - free(as->name); + free(as->challenge); + free(as->class); + free(as->style); + free(as->name); free(as); return (s); @@ -455,8 +451,7 @@ auth_setitem(auth_session_t *as, auth_it return (0); if (value != NULL && (value = strdup(value)) == NULL) return (-1); - if (as->challenge) - free(as->challenge); + free(as->challenge); as->challenge = value; return (0); @@ -465,8 +460,7 @@ auth_setitem(auth_session_t *as, auth_it return (0); if (value != NULL && (value = strdup(value)) == NULL) return (-1); - if (as->class) - free(as->class); + free(as->class); as->class = value; return (0); @@ -475,8 +469,7 @@ auth_setitem(auth_session_t *as, auth_it return (0); if (value != NULL && (value = strdup(value)) == NULL) return (-1); - if (as->name) - free(as->name); + free(as->name); as->name = value; return (0); @@ -498,8 +491,7 @@ auth_setitem(auth_session_t *as, auth_it if (value == NULL || strchr(value, '/') != NULL || (value = strdup(value)) == NULL) return (-1); - if (as->style) - free(as->style); + free(as->style); as->style = value; return (0); Index: lib/libc/gen/authenticate.c =================================================================== RCS file: /cvs/src/lib/libc/gen/authenticate.c,v retrieving revision 1.22 diff -u -p -r1.22 authenticate.c --- lib/libc/gen/authenticate.c 31 Aug 2015 02:53:57 -0000 1.22 +++ lib/libc/gen/authenticate.c 9 Sep 2015 15:38:51 -0000 @@ -256,8 +256,7 @@ auth_approval(auth_session_t *as, login_ login_close(lc); syslog(LOG_ERR, "%m"); warn(NULL); - if (approve) - free(approve); + free(approve); return (0); } @@ -291,8 +290,7 @@ auth_approval(auth_session_t *as, login_ lc->lc_class, type, (char *)NULL); out: - if (approve) - free(approve); + free(approve); if (close_lc_on_exit) login_close(lc); Index: lib/libc/gen/fts.c =================================================================== RCS file: /cvs/src/lib/libc/gen/fts.c,v retrieving revision 1.50 diff -u -p -r1.50 fts.c --- lib/libc/gen/fts.c 16 Jan 2015 16:48:51 -0000 1.50 +++ lib/libc/gen/fts.c 9 Sep 2015 15:38:51 -0000 @@ -227,8 +227,7 @@ fts_close(FTS *sp) /* Free up child linked list, sort array, path buffer, stream ptr.*/ if (sp->fts_child) fts_lfree(sp->fts_child); - if (sp->fts_array) - free(sp->fts_array); + free(sp->fts_array); free(sp->fts_path); free(sp); @@ -663,8 +662,7 @@ fts_build(FTS *sp, int type) * structures already allocated. */ mem1: saved_errno = errno; - if (p) - free(p); + free(p); fts_lfree(head); (void)closedir(dirp); cur->fts_info = FTS_ERR; @@ -884,8 +882,7 @@ fts_sort(FTS *sp, FTSENT *head, int nite sp->fts_nitems = nitems + 40; if ((a = reallocarray(sp->fts_array, sp->fts_nitems, sizeof(FTSENT *))) == NULL) { - if (sp->fts_array) - free(sp->fts_array); + free(sp->fts_array); sp->fts_array = NULL; sp->fts_nitems = 0; return (head); @@ -959,8 +956,7 @@ fts_palloc(FTS *sp, size_t more) */ more += 256; if (sp->fts_pathlen + more < sp->fts_pathlen) { - if (sp->fts_path) - free(sp->fts_path); + free(sp->fts_path); sp->fts_path = NULL; errno = ENAMETOOLONG; return (1); @@ -968,8 +964,7 @@ fts_palloc(FTS *sp, size_t more) sp->fts_pathlen += more; p = realloc(sp->fts_path, sp->fts_pathlen); if (p == NULL) { - if (sp->fts_path) - free(sp->fts_path); + free(sp->fts_path); sp->fts_path = NULL; return (1); } Index: lib/libc/gen/getcap.c =================================================================== RCS file: /cvs/src/lib/libc/gen/getcap.c,v retrieving revision 1.31 diff -u -p -r1.31 getcap.c --- lib/libc/gen/getcap.c 15 Sep 2014 06:15:48 -0000 1.31 +++ lib/libc/gen/getcap.c 9 Sep 2015 15:38:51 -0000 @@ -86,8 +86,7 @@ int cgetset(const char *ent) { if (ent == NULL) { - if (toprec) - free(toprec); + free(toprec); toprec = NULL; topreclen = 0; return (0); @@ -350,8 +349,7 @@ getent(char **cap, u_int *len, char **db newsize = r_end - record + BFRAG; nrecord = realloc(record, newsize); if (nrecord == NULL) { - if (record) - free(record); + free(record); if (myfd) (void)fclose(fp); errno = ENOMEM; @@ -494,8 +492,7 @@ tc_exp: { tcposend = tcend - record; nrecord = realloc(record, newsize); if (nrecord == NULL) { - if (record) - free(record); + free(record); if (myfd) (void)fclose(fp); free(ibuf); @@ -538,8 +535,7 @@ tc_exp: { if ((nrecord = realloc(record, (size_t)(rp - record))) == NULL) { - if (record) - free(record); + free(record); errno = ENOMEM; return (-2); } @@ -902,8 +898,7 @@ cgetstr(char *buf, const char *cap, char char *nmem; if ((nmem = realloc(mem, size + SFRAG)) == NULL) { - if (mem) - free(mem); + free(mem); return (-2); } mem = nmem; @@ -922,8 +917,7 @@ cgetstr(char *buf, const char *cap, char char *nmem; if ((nmem = realloc(mem, (size_t)(mp - mem))) == NULL) { - if (mem) - free(mem); + free(mem); return (-2); } mem = nmem; @@ -984,8 +978,7 @@ cgetustr(char *buf, const char *cap, cha char *nmem; if ((nmem = realloc(mem, size + SFRAG)) == NULL) { - if (mem) - free(mem); + free(mem); return (-2); } mem = nmem; @@ -1004,8 +997,7 @@ cgetustr(char *buf, const char *cap, cha char *nmem; if ((nmem = realloc(mem, mp - mem)) == NULL) { - if (mem) - free(mem); + free(mem); return (-2); } mem = nmem; Index: lib/libc/gen/getgrent.c =================================================================== RCS file: /cvs/src/lib/libc/gen/getgrent.c,v retrieving revision 1.42 diff -u -p -r1.42 getgrent.c --- lib/libc/gen/getgrent.c 16 Jan 2015 16:48:51 -0000 1.42 +++ lib/libc/gen/getgrent.c 9 Sep 2015 15:38:51 -0000 @@ -198,8 +198,7 @@ start_gr(void) rewind(_gr_fp); #ifdef YP __ypmode = 0; - if (__ypcurrent) - free(__ypcurrent); + free(__ypcurrent); __ypcurrent = NULL; if (__ypexhead) __ypexclude_free(&__ypexhead); @@ -248,8 +247,7 @@ endgrent_basic(void) _gr_fp = NULL; #ifdef YP __ypmode = 0; - if (__ypcurrent) - free(__ypcurrent); + free(__ypcurrent); __ypcurrent = NULL; if (__ypexhead) __ypexclude_free(&__ypexhead); Index: lib/libc/gen/getmntinfo.c =================================================================== RCS file: /cvs/src/lib/libc/gen/getmntinfo.c,v retrieving revision 1.9 diff -u -p -r1.9 getmntinfo.c --- lib/libc/gen/getmntinfo.c 20 Aug 2015 21:49:29 -0000 1.9 +++ lib/libc/gen/getmntinfo.c 9 Sep 2015 15:38:51 -0000 @@ -47,8 +47,7 @@ getmntinfo(struct statfs **mntbufp, int if (bufsize > 0 && (mntsize = getfsstat(mntbuf, bufsize, flags)) < 0) return (0); while (bufsize <= mntsize * sizeof(struct statfs)) { - if (mntbuf) - free(mntbuf); + free(mntbuf); bufsize = (mntsize + 1) * sizeof(struct statfs); if ((mntbuf = malloc(bufsize)) == 0) { bufsize = 0; Index: lib/libc/gen/getnetgrent.c =================================================================== RCS file: /cvs/src/lib/libc/gen/getnetgrent.c,v retrieving revision 1.24 diff -u -p -r1.24 getnetgrent.c --- lib/libc/gen/getnetgrent.c 31 Aug 2015 02:53:57 -0000 1.24 +++ lib/libc/gen/getnetgrent.c 9 Sep 2015 15:38:51 -0000 @@ -226,11 +226,9 @@ getnetgroup(char **pp) return ng; baddomain: - if (ng->ng_user) - free(ng->ng_user); + free(ng->ng_user); baduser: - if (ng->ng_host) - free(ng->ng_host); + free(ng->ng_host); badhost: free(ng); return NULL; @@ -691,8 +689,7 @@ innetgr(const char *grp, const char *hos else if (lookup(NULL, "+", &line, _NG_KEYBYNAME) == 0) yp_get_default_domain(&ypdom); - if (line) - free(line); + free(line); #endif /* Try the fast lookup first */ Index: lib/libc/gen/getpwent.c =================================================================== RCS file: /cvs/src/lib/libc/gen/getpwent.c,v retrieving revision 1.54 diff -u -p -r1.54 getpwent.c --- lib/libc/gen/getpwent.c 3 Jun 2015 02:24:36 -0000 1.54 +++ lib/libc/gen/getpwent.c 9 Sep 2015 15:38:51 -0000 @@ -294,8 +294,7 @@ again: __ypcurrent = NULL; if (r != 0) { __ypmode = YPMODE_NONE; - if (data) - free(data); + free(data); goto again; } __ypcurrent = key; @@ -307,8 +306,7 @@ again: if (r != 0 || __ypcurrentlen > sizeof(__ypline)) { __ypmode = YPMODE_NONE; - if (data) - free(data); + free(data); goto again; } } @@ -333,8 +331,7 @@ again: * if the netgroup is invalid, keep looking * as there may be valid users later on. */ - if (data) - free(data); + free(data); goto again; } bcopy(data, __ypline, datalen); @@ -349,8 +346,7 @@ again: name = NULL; if (r != 0 || __ypcurrentlen > sizeof(__ypline)) { - if (data) - free(data); + free(data); goto again; } bcopy(data, __ypline, datalen); @@ -506,8 +502,7 @@ __has_ypmaster(void) return (checked); } free(result); - if (key) - free(key); + free(key); saved_uid = uid; saved_euid = euid; @@ -566,8 +561,7 @@ __yppwlookup(int lookup, char *name, uid name, strlen(name), &ypcurrent, &ypcurrentlen); if (r != 0 || ypcurrentlen > buflen) { - if (ypcurrent) - free(ypcurrent); + free(ypcurrent); ypcurrent = NULL; continue; } @@ -593,8 +587,7 @@ pwnam_netgrp: } else goto pwnam_netgrp; if (r != 0 || ypcurrentlen > buflen) { - if (ypcurrent) - free(ypcurrent); + free(ypcurrent); ypcurrent = NULL; /* * just because this @@ -615,8 +608,7 @@ pwnam_netgrp: user, strlen(user), &ypcurrent, &ypcurrentlen); if (r != 0 || ypcurrentlen > buflen) { - if (ypcurrent) - free(ypcurrent); + free(ypcurrent); ypcurrent = NULL; continue; } @@ -661,8 +653,7 @@ pwnam_netgrp: done: __ypexclude_free(&ypexhead); __ypproto = NULL; - if (ypcurrent) - free(ypcurrent); + free(ypcurrent); ypcurrent = NULL; if (map) free(name); @@ -836,8 +827,7 @@ setpassent(int stayopen) _pw_stayopen = stayopen; #ifdef YP __ypmode = YPMODE_NONE; - if (__ypcurrent) - free(__ypcurrent); + free(__ypcurrent); __ypcurrent = NULL; __ypexclude_free(&__ypexhead); __ypproto = NULL; @@ -866,8 +856,7 @@ endpwent(void) } #ifdef YP __ypmode = YPMODE_NONE; - if (__ypcurrent) - free(__ypcurrent); + free(__ypcurrent); __ypcurrent = NULL; __ypexclude_free(&__ypexhead); __ypproto = NULL; Index: lib/libc/gen/glob.c =================================================================== RCS file: /cvs/src/lib/libc/gen/glob.c,v retrieving revision 1.43 diff -u -p -r1.43 glob.c --- lib/libc/gen/glob.c 13 Jun 2015 16:57:04 -0000 1.43 +++ lib/libc/gen/glob.c 9 Sep 2015 15:38:51 -0000 @@ -954,8 +954,7 @@ globfree(glob_t *pglob) if (pglob->gl_pathv != NULL) { pp = pglob->gl_pathv + pglob->gl_offs; for (i = pglob->gl_pathc; i--; ++pp) - if (*pp) - free(*pp); + free(*pp); free(pglob->gl_pathv); pglob->gl_pathv = NULL; } Index: lib/libc/gen/login_cap.c =================================================================== RCS file: /cvs/src/lib/libc/gen/login_cap.c,v retrieving revision 1.30 diff -u -p -r1.30 login_cap.c --- lib/libc/gen/login_cap.c 1 Apr 2014 02:16:37 -0000 1.30 +++ lib/libc/gen/login_cap.c 9 Sep 2015 15:38:51 -0000 @@ -208,10 +208,8 @@ login_getstyle(login_cap_t *lc, char *st if (lc->lc_style == NULL) syslog(LOG_ERR, "strdup: %m"); } - if (f1) - free(f1); - if (f2) - free(f2); + free(f1); + free(f2); return (lc->lc_style); } @@ -267,12 +265,10 @@ login_getcaptime(login_cap_t *lc, char * switch (stat = cgetstr(lc->lc_cap, cap, &res)) { case -1: - if (res) - free(res); + free(res); return (def); case -2: - if (res) - free(res); + free(res); syslog(LOG_ERR, "%s: getting capability %s: %m", lc->lc_class, cap); errno = ERANGE; @@ -280,8 +276,7 @@ login_getcaptime(login_cap_t *lc, char * default: if (stat >= 0) break; - if (res) - free(res); + free(res); syslog(LOG_ERR, "%s: unexpected error with capability %s", lc->lc_class, cap); errno = ERANGE; @@ -355,12 +350,10 @@ login_getcapnum(login_cap_t *lc, char *c switch (stat = cgetstr(lc->lc_cap, cap, &res)) { case -1: - if (res) - free(res); + free(res); return (def); case -2: - if (res) - free(res); + free(res); syslog(LOG_ERR, "%s: getting capability %s: %m", lc->lc_class, cap); errno = ERANGE; @@ -368,8 +361,7 @@ login_getcapnum(login_cap_t *lc, char *c default: if (stat >= 0) break; - if (res) - free(res); + free(res); syslog(LOG_ERR, "%s: unexpected error with capability %s", lc->lc_class, cap); errno = ERANGE; @@ -412,12 +404,10 @@ login_getcapsize(login_cap_t *lc, char * switch (stat = cgetstr(lc->lc_cap, cap, &res)) { case -1: - if (res) - free(res); + free(res); return (def); case -2: - if (res) - free(res); + free(res); syslog(LOG_ERR, "%s: getting capability %s: %m", lc->lc_class, cap); errno = ERANGE; @@ -425,8 +415,7 @@ login_getcapsize(login_cap_t *lc, char * default: if (stat >= 0) break; - if (res) - free(res); + free(res); syslog(LOG_ERR, "%s: unexpected error with capability %s", lc->lc_class, cap); errno = ERANGE; @@ -460,12 +449,9 @@ void login_close(login_cap_t *lc) { if (lc) { - if (lc->lc_class) - free(lc->lc_class); - if (lc->lc_cap) - free(lc->lc_cap); - if (lc->lc_style) - free(lc->lc_style); + free(lc->lc_class); + free(lc->lc_cap); + free(lc->lc_style); free(lc); } } Index: lib/libc/locale/rune.c =================================================================== RCS file: /cvs/src/lib/libc/locale/rune.c,v retrieving revision 1.4 diff -u -p -r1.4 rune.c --- lib/libc/locale/rune.c 25 May 2014 17:47:04 -0000 1.4 +++ lib/libc/locale/rune.c 9 Sep 2015 15:38:51 -0000 @@ -183,8 +183,7 @@ _freeentry(_RuneRange *rr) re = rr->rr_rune_ranges; for (i = 0; i < rr->rr_nranges; i++) { - if (re[i].re_rune_types) - free(re[i].re_rune_types); + free(re[i].re_rune_types); re[i].re_rune_types = NULL; } } Index: lib/libc/net/freeaddrinfo.c =================================================================== RCS file: /cvs/src/lib/libc/net/freeaddrinfo.c,v retrieving revision 1.6 diff -u -p -r1.6 freeaddrinfo.c --- lib/libc/net/freeaddrinfo.c 25 Mar 2005 13:24:11 -0000 1.6 +++ lib/libc/net/freeaddrinfo.c 9 Sep 2015 15:38:51 -0000 @@ -43,8 +43,7 @@ freeaddrinfo(struct addrinfo *ai) do { p = ai; ai = ai->ai_next; - if (p->ai_canonname) - free(p->ai_canonname); + free(p->ai_canonname); free((void *)p); } while (ai); } Index: lib/libc/regex/regcomp.c =================================================================== RCS file: /cvs/src/lib/libc/regex/regcomp.c,v retrieving revision 1.26 diff -u -p -r1.26 regcomp.c --- lib/libc/regex/regcomp.c 18 Oct 2014 04:12:28 -0000 1.26 +++ lib/libc/regex/regcomp.c 9 Sep 2015 15:38:51 -0000 @@ -1184,8 +1184,7 @@ mcadd( struct parse *p, cset *cs, char * cs->smultis += strlen(cp) + 1; np = realloc(cs->multis, cs->smultis); if (np == NULL) { - if (cs->multis) - free(cs->multis); + free(cs->multis); cs->multis = NULL; SETERROR(REG_ESPACE); return; Index: lib/libc/rpc/pmap_rmt.c =================================================================== RCS file: /cvs/src/lib/libc/rpc/pmap_rmt.c,v retrieving revision 1.32 diff -u -p -r1.32 pmap_rmt.c --- lib/libc/rpc/pmap_rmt.c 20 Aug 2015 21:49:29 -0000 1.32 +++ lib/libc/rpc/pmap_rmt.c 9 Sep 2015 15:38:51 -0000 @@ -371,8 +371,7 @@ clnt_broadcast(u_long prog, /* program n } } done_broad: - if (addrs) - free(addrs); + free(addrs); if (sock >= 0) (void)close(sock); if (unix_auth != NULL) Index: lib/libc/stdio/vfprintf.c =================================================================== RCS file: /cvs/src/lib/libc/stdio/vfprintf.c,v retrieving revision 1.68 diff -u -p -r1.68 vfprintf.c --- lib/libc/stdio/vfprintf.c 31 Aug 2015 02:53:57 -0000 1.68 +++ lib/libc/stdio/vfprintf.c 9 Sep 2015 15:38:51 -0000 @@ -1076,8 +1076,7 @@ overflow: finish: #ifdef PRINTF_WIDE_CHAR - if (convbuf) - free(convbuf); + free(convbuf); #endif #ifdef FLOATING_POINT if (dtoaresult) Index: lib/libc/stdio/vfwprintf.c =================================================================== RCS file: /cvs/src/lib/libc/stdio/vfwprintf.c,v retrieving revision 1.13 diff -u -p -r1.13 vfwprintf.c --- lib/libc/stdio/vfwprintf.c 31 Aug 2015 02:53:57 -0000 1.13 +++ lib/libc/stdio/vfwprintf.c 9 Sep 2015 15:38:51 -0000 @@ -1048,8 +1048,7 @@ overflow: ret = -1; finish: - if (convbuf) - free(convbuf); + free(convbuf); #ifdef FLOATING_POINT if (dtoaresult) __freedtoa(dtoaresult); Index: lib/libc/time/strftime.c =================================================================== RCS file: /cvs/src/lib/libc/time/strftime.c,v retrieving revision 1.26 diff -u -p -r1.26 strftime.c --- lib/libc/time/strftime.c 16 Feb 2015 17:11:54 -0000 1.26 +++ lib/libc/time/strftime.c 9 Sep 2015 15:38:51 -0000 @@ -670,8 +670,7 @@ _loc(void) locale_buf = NULL; nlbuf = (lbuf == NULL) ? malloc(bufsize) : realloc(lbuf, bufsize); if (nlbuf == NULL) { - if (lbuf) - free(lbuf); + free(lbuf); lbuf = NULL; goto bad_locale; } Index: lib/libcurses/tinfo/read_bsd_terminfo.c =================================================================== RCS file: /cvs/src/lib/libcurses/tinfo/read_bsd_terminfo.c,v retrieving revision 1.18 diff -u -p -r1.18 read_bsd_terminfo.c --- lib/libcurses/tinfo/read_bsd_terminfo.c 12 Jan 2010 23:22:06 -0000 1.18 +++ lib/libcurses/tinfo/read_bsd_terminfo.c 9 Sep 2015 15:38:51 -0000 @@ -252,10 +252,8 @@ _nc_lookup_bsd_terminfo_entry(tn, filena } done: - if (capbuf) - free(capbuf); - if (infobuf) - free(infobuf); + free(capbuf); + free(infobuf); cgetclose(); return ((error == 0)); Index: lib/libedit/filecomplete.c =================================================================== RCS file: /cvs/src/lib/libedit/filecomplete.c,v retrieving revision 1.4 diff -u -p -r1.4 filecomplete.c --- lib/libedit/filecomplete.c 17 Oct 2014 06:07:50 -0000 1.4 +++ lib/libedit/filecomplete.c 9 Sep 2015 15:38:51 -0000 @@ -260,8 +260,7 @@ append_char_function(const char *name) if (S_ISDIR(stbuf.st_mode)) rs = "/"; out: - if (expname) - free(expname); + free(expname); return rs; } /* Index: lib/libedit/readline.c =================================================================== RCS file: /cvs/src/lib/libedit/readline.c,v retrieving revision 1.14 diff -u -p -r1.14 readline.c --- lib/libedit/readline.c 6 Feb 2015 23:21:58 -0000 1.14 +++ lib/libedit/readline.c 9 Sep 2015 15:38:51 -0000 @@ -259,8 +259,7 @@ rl_set_prompt(const char *prompt) prompt = ""; if (rl_prompt != NULL && strcmp(rl_prompt, prompt) == 0) return 0; - if (rl_prompt) - free(rl_prompt); + free(rl_prompt); rl_prompt = strdup(prompt); if (rl_prompt == NULL) return -1; @@ -579,8 +578,7 @@ get_history_event(const char *cmd, int * if (sub) { if (pat != last_search_pat) { - if (last_search_pat) - free(last_search_pat); + free(last_search_pat); last_search_pat = pat; } ret = history_search(pat, -1); @@ -677,8 +675,7 @@ _history_expand_command(const char *comm if (!has_mods) { *result = strdup(aptr ? aptr : ptr); - if (aptr) - free(aptr); + free(aptr); if (*result == NULL) return -1; return(1); @@ -725,15 +722,13 @@ _history_expand_command(const char *comm if (tmp == NULL) { (void)fprintf(rl_outstream, "%s: Bad word specifier", command + offs + idx); - if (aptr) - free(aptr); + free(aptr); return(-1); } } else tmp = strdup(aptr? aptr:ptr); - if (aptr) - free(aptr); + free(aptr); if (*cmd == '\0' || ((size_t)(cmd - (command + offs)) >= cmdlen)) { *result = tmp; Index: lib/libevent/kqueue.c =================================================================== RCS file: /cvs/src/lib/libevent/kqueue.c,v retrieving revision 1.36 diff -u -p -r1.36 kqueue.c --- lib/libevent/kqueue.c 30 Oct 2014 16:45:37 -0000 1.36 +++ lib/libevent/kqueue.c 9 Sep 2015 15:38:51 -0000 @@ -420,10 +420,8 @@ kq_dealloc(struct event_base *base, void evsignal_dealloc(base); - if (kqop->changes) - free(kqop->changes); - if (kqop->events) - free(kqop->events); + free(kqop->changes); + free(kqop->events); if (kqop->kq >= 0 && kqop->pid == getpid()) close(kqop->kq); Index: lib/libevent/poll.c =================================================================== RCS file: /cvs/src/lib/libevent/poll.c,v retrieving revision 1.21 diff -u -p -r1.21 poll.c --- lib/libevent/poll.c 30 Oct 2014 16:45:37 -0000 1.21 +++ lib/libevent/poll.c 9 Sep 2015 15:38:51 -0000 @@ -359,14 +359,10 @@ poll_dealloc(struct event_base *base, vo struct pollop *pop = arg; evsignal_dealloc(base); - if (pop->event_set) - free(pop->event_set); - if (pop->event_r_back) - free(pop->event_r_back); - if (pop->event_w_back) - free(pop->event_w_back); - if (pop->idxplus1_by_fd) - free(pop->idxplus1_by_fd); + free(pop->event_set); + free(pop->event_r_back); + free(pop->event_w_back); + free(pop->idxplus1_by_fd); memset(pop, 0, sizeof(struct pollop)); free(pop); Index: lib/libevent/select.c =================================================================== RCS file: /cvs/src/lib/libevent/select.c,v retrieving revision 1.24 diff -u -p -r1.24 select.c --- lib/libevent/select.c 30 Oct 2014 13:43:28 -0000 1.24 +++ lib/libevent/select.c 9 Sep 2015 15:38:51 -0000 @@ -326,18 +326,12 @@ select_dealloc(struct event_base *base, struct selectop *sop = arg; evsignal_dealloc(base); - if (sop->event_readset_in) - free(sop->event_readset_in); - if (sop->event_writeset_in) - free(sop->event_writeset_in); - if (sop->event_readset_out) - free(sop->event_readset_out); - if (sop->event_writeset_out) - free(sop->event_writeset_out); - if (sop->event_r_by_fd) - free(sop->event_r_by_fd); - if (sop->event_w_by_fd) - free(sop->event_w_by_fd); + free(sop->event_readset_in); + free(sop->event_writeset_in); + free(sop->event_readset_out); + free(sop->event_writeset_out); + free(sop->event_r_by_fd); + free(sop->event_w_by_fd); memset(sop, 0, sizeof(struct selectop)); free(sop); Index: lib/libform/frm_def.c =================================================================== RCS file: /cvs/src/lib/libform/frm_def.c,v retrieving revision 1.8 diff -u -p -r1.8 frm_def.c --- lib/libform/frm_def.c 23 Jan 2015 22:48:51 -0000 1.8 +++ lib/libform/frm_def.c 9 Sep 2015 15:38:51 -0000 @@ -136,8 +136,7 @@ Disconnect_Fields(FORM *form) form->rows = form->cols = 0; form->maxfield = form->maxpage = -1; form->field = (FIELD **)0; - if (form->page) - free(form->page); + free(form->page); form->page = (_PAGE *) 0; } } Index: lib/libform/fty_alnum.c =================================================================== RCS file: /cvs/src/lib/libform/fty_alnum.c,v retrieving revision 1.9 diff -u -p -r1.9 fty_alnum.c --- lib/libform/fty_alnum.c 23 Jan 2015 22:48:51 -0000 1.9 +++ lib/libform/fty_alnum.c 9 Sep 2015 15:38:51 -0000 @@ -101,8 +101,7 @@ Copy_This_Type(const void *argp) static void Free_This_Type(void *argp) { - if (argp) - free(argp); + free(argp); } /*--------------------------------------------------------------------------- Index: lib/libform/fty_alpha.c =================================================================== RCS file: /cvs/src/lib/libform/fty_alpha.c,v retrieving revision 1.9 diff -u -p -r1.9 fty_alpha.c --- lib/libform/fty_alpha.c 23 Jan 2015 22:48:51 -0000 1.9 +++ lib/libform/fty_alpha.c 9 Sep 2015 15:38:51 -0000 @@ -101,8 +101,7 @@ Copy_This_Type(const void *argp) static void Free_This_Type(void *argp) { - if (argp) - free(argp); + free(argp); } /*--------------------------------------------------------------------------- Index: lib/libform/fty_enum.c =================================================================== RCS file: /cvs/src/lib/libform/fty_enum.c,v retrieving revision 1.11 diff -u -p -r1.11 fty_enum.c --- lib/libform/fty_enum.c 23 Jan 2015 22:48:51 -0000 1.11 +++ lib/libform/fty_enum.c 9 Sep 2015 15:38:51 -0000 @@ -120,8 +120,7 @@ Copy_Enum_Type(const void *argp) static void Free_Enum_Type(void *argp) { - if (argp) - free(argp); + free(argp); } #define SKIP_SPACE(x) while(((*(x))!='\0') && (is_blank(*(x)))) (x)++ Index: lib/libform/fty_int.c =================================================================== RCS file: /cvs/src/lib/libform/fty_int.c,v retrieving revision 1.9 diff -u -p -r1.9 fty_int.c --- lib/libform/fty_int.c 23 Jan 2015 22:48:51 -0000 1.9 +++ lib/libform/fty_int.c 9 Sep 2015 15:38:51 -0000 @@ -113,8 +113,7 @@ Copy_This_Type(const void *argp) static void Free_This_Type(void *argp) { - if (argp) - free(argp); + free(argp); } /*--------------------------------------------------------------------------- Index: lib/libform/fty_num.c =================================================================== RCS file: /cvs/src/lib/libform/fty_num.c,v retrieving revision 1.9 diff -u -p -r1.9 fty_num.c --- lib/libform/fty_num.c 23 Jan 2015 22:48:51 -0000 1.9 +++ lib/libform/fty_num.c 9 Sep 2015 15:38:51 -0000 @@ -130,8 +130,7 @@ Copy_This_Type(const void *argp) static void Free_This_Type(void *argp) { - if (argp) - free(argp); + free(argp); } /*--------------------------------------------------------------------------- Index: lib/libform/fty_regex.c =================================================================== RCS file: /cvs/src/lib/libform/fty_regex.c,v retrieving revision 1.9 diff -u -p -r1.9 fty_regex.c --- lib/libform/fty_regex.c 23 Jan 2015 22:48:51 -0000 1.9 +++ lib/libform/fty_regex.c 9 Sep 2015 15:38:51 -0000 @@ -122,8 +122,7 @@ Make_RegularExpression_Type(va_list *ap) } else { - if (preg->pRegExp) - free(preg->pRegExp); + free(preg->pRegExp); free(preg); preg = (RegExp_Arg *)0; } Index: lib/libfuse/fuse.c =================================================================== RCS file: /cvs/src/lib/libfuse/fuse.c,v retrieving revision 1.26 diff -u -p -r1.26 fuse.c --- lib/libfuse/fuse.c 7 Jul 2015 13:56:45 -0000 1.26 +++ lib/libfuse/fuse.c 9 Sep 2015 15:38:51 -0000 @@ -478,8 +478,7 @@ fuse_setup(int argc, char **argv, const return (fuse); err: - if (*mp) - free(*mp); + free(*mp); return (NULL); } Index: lib/libkeynote/signature.c =================================================================== RCS file: /cvs/src/lib/libkeynote/signature.c,v retrieving revision 1.19 diff -u -p -r1.19 signature.c --- lib/libkeynote/signature.c 13 Nov 2013 16:28:17 -0000 1.19 +++ lib/libkeynote/signature.c 9 Sep 2015 15:38:51 -0000 @@ -563,16 +563,14 @@ kn_decode_key(struct keynote_deckey *dc, { if ((px509Cert = X509_new()) == (X509 *) NULL) { - if (ptr) - free(ptr); + free(ptr); keynote_errno = ERROR_MEMORY; return -1; } if(d2i_X509(&px509Cert, (const unsigned char **)&decoded, len) == NULL) { - if (ptr) - free(ptr); + free(ptr); X509_free(px509Cert); keynote_errno = ERROR_SYNTAX; return -1; @@ -580,8 +578,7 @@ kn_decode_key(struct keynote_deckey *dc, if ((pPublicKey = X509_get_pubkey(px509Cert)) == (EVP_PKEY *) NULL) { - if (ptr) - free(ptr); + free(ptr); X509_free(px509Cert); keynote_errno = ERROR_SYNTAX; return -1; @@ -590,8 +587,7 @@ kn_decode_key(struct keynote_deckey *dc, /* RSA-specific */ dc->dec_key = pPublicKey->pkey.rsa; - if(ptr) - free(ptr); + free(ptr); return 0; } Index: usr.sbin/rtadvd/if.c =================================================================== RCS file: /cvs/src/usr.sbin/rtadvd/if.c,v retrieving revision 1.28 diff -u -p -r1.28 if.c --- usr.sbin/rtadvd/if.c 20 Aug 2015 22:39:29 -0000 1.28 +++ usr.sbin/rtadvd/if.c 9 Sep 2015 15:38:53 -0000 @@ -519,8 +519,7 @@ init_iflist() free(ifblock); ifblock_size = 0; } - if (iflist) - free(iflist); + free(iflist); /* get iflist block from kernel */ get_iflist(&ifblock, &ifblock_size); Index: usr.sbin/sasyncd/net.c =================================================================== RCS file: /cvs/src/usr.sbin/sasyncd/net.c,v retrieving revision 1.22 diff -u -p -r1.22 net.c --- usr.sbin/sasyncd/net.c 20 Aug 2015 22:39:29 -0000 1.22 +++ usr.sbin/sasyncd/net.c 9 Sep 2015 15:38:53 -0000 @@ -641,10 +641,8 @@ net_shutdown(void) free(qm); } net_disconnect_peer(p); - if (p->sa) - free(p->sa); - if (p->name) - free(p->name); + free(p->sa); + free(p->name); LIST_REMOVE(p, link); cfgstate.peercnt--; free(p); Index: usr.sbin/smtpd/aldap.c =================================================================== RCS file: /cvs/src/usr.sbin/smtpd/aldap.c,v retrieving revision 1.7 diff -u -p -r1.7 aldap.c --- usr.sbin/smtpd/aldap.c 19 Apr 2014 14:37:45 -0000 1.7 +++ usr.sbin/smtpd/aldap.c 9 Sep 2015 15:38:53 -0000 @@ -353,8 +353,7 @@ aldap_parse_page_control(struct ber_elem void aldap_freepage(struct aldap_page_control *page) { - if (page->cookie) - free(page->cookie); + free(page->cookie); free(page); } Index: usr.sbin/smtpd/forward.c =================================================================== RCS file: /cvs/src/usr.sbin/smtpd/forward.c,v retrieving revision 1.36 diff -u -p -r1.36 forward.c --- usr.sbin/smtpd/forward.c 20 Jan 2015 17:37:54 -0000 1.36 +++ usr.sbin/smtpd/forward.c 9 Sep 2015 15:38:53 -0000 @@ -88,8 +88,7 @@ forwards_get(int fd, struct expand *expa ret = expand->nb_nodes > save ? 1 : 0; end: - if (line) - free(line); + free(line); if (fp) fclose(fp); else Index: usr.sbin/smtpd/iobuf.c =================================================================== RCS file: /cvs/src/usr.sbin/smtpd/iobuf.c,v retrieving revision 1.6 diff -u -p -r1.6 iobuf.c --- usr.sbin/smtpd/iobuf.c 3 Sep 2015 06:26:17 -0000 1.6 +++ usr.sbin/smtpd/iobuf.c 9 Sep 2015 15:38:53 -0000 @@ -67,8 +67,7 @@ iobuf_clear(struct iobuf *io) { struct ioqbuf *q; - if (io->buf) - free(io->buf); + free(io->buf); while ((q = io->outq)) { io->outq = q->next; Index: usr.sbin/smtpd/mda.c =================================================================== RCS file: /cvs/src/usr.sbin/smtpd/mda.c,v retrieving revision 1.109 diff -u -p -r1.109 mda.c --- usr.sbin/smtpd/mda.c 20 Jan 2015 17:37:54 -0000 1.109 +++ usr.sbin/smtpd/mda.c 9 Sep 2015 15:38:53 -0000 @@ -588,8 +588,7 @@ mda_check_loop(FILE *fp, struct mda_enve lbuf = NULL; } } - if (lbuf) - free(lbuf); + free(lbuf); fseek(fp, SEEK_SET, 0); Index: usr.sbin/smtpd/mta_session.c =================================================================== RCS file: /cvs/src/usr.sbin/smtpd/mta_session.c,v retrieving revision 1.71 diff -u -p -r1.71 mta_session.c --- usr.sbin/smtpd/mta_session.c 20 Jan 2015 17:37:54 -0000 1.71 +++ usr.sbin/smtpd/mta_session.c 9 Sep 2015 15:38:53 -0000 @@ -437,8 +437,7 @@ mta_free(struct mta_session *s) fatalx("current task should have been deleted already"); if (s->datafp) fclose(s->datafp); - if (s->helo) - free(s->helo); + free(s->helo); relay = s->relay; route = s->route; Index: usr.sbin/smtpd/smtpd.c =================================================================== RCS file: /cvs/src/usr.sbin/smtpd/smtpd.c,v retrieving revision 1.239 diff -u -p -r1.239 smtpd.c --- usr.sbin/smtpd/smtpd.c 3 Jun 2015 02:24:36 -0000 1.239 +++ usr.sbin/smtpd/smtpd.c 9 Sep 2015 15:38:53 -0000 @@ -389,8 +389,7 @@ parent_sig_handler(int sig, short event, cause = child->cause; child->cause = NULL; } - if (child->cause) - free(child->cause); + free(child->cause); log_debug("debug: smtpd: mda process done " "for session %016"PRIx64 ": %s", child->mda_id, cause); Index: usr.sbin/snmpd/agentx.c =================================================================== RCS file: /cvs/src/usr.sbin/snmpd/agentx.c,v retrieving revision 1.9 diff -u -p -r1.9 agentx.c --- usr.sbin/snmpd/agentx.c 19 Jul 2015 01:08:07 -0000 1.9 +++ usr.sbin/snmpd/agentx.c 9 Sep 2015 15:38:53 -0000 @@ -259,8 +259,7 @@ void snmp_agentx_pdu_free(struct agentx_pdu *pdu) { free(pdu->buffer); - if (pdu->request) - free(pdu->request); + free(pdu->request); free(pdu); } Index: usr.sbin/snmpd/control.c =================================================================== RCS file: /cvs/src/usr.sbin/snmpd/control.c,v retrieving revision 1.29 diff -u -p -r1.29 control.c --- usr.sbin/snmpd/control.c 28 May 2015 17:08:09 -0000 1.29 +++ usr.sbin/snmpd/control.c 9 Sep 2015 15:38:53 -0000 @@ -613,8 +613,7 @@ control_dispatch_agentx(int fd, short ev uptime = smi_getticks(); if ((pdu = snmp_agentx_response_pdu(uptime, error, idx)) == NULL) { log_debug("failed to generate response"); - if (varcpy) - free(varcpy); + free(varcpy); control_event_add(c, fd, EV_WRITE, NULL); /* XXX -- EV_WRITE? */ return; } @@ -639,8 +638,7 @@ control_dispatch_agentx(int fd, short ev log_debug("subagent session '%i' destroyed", h->sessionid); snmp_agentx_free(h); purge_registered_oids(&c->oids); - if (varcpy) - free(varcpy); + free(varcpy); control_close(c); } Index: usr.sbin/snmpd/trap.c =================================================================== RCS file: /cvs/src/usr.sbin/snmpd/trap.c,v retrieving revision 1.24 diff -u -p -r1.24 trap.c --- usr.sbin/snmpd/trap.c 16 Jan 2015 00:05:13 -0000 1.24 +++ usr.sbin/snmpd/trap.c 9 Sep 2015 15:38:53 -0000 @@ -138,8 +138,7 @@ trap_agentx(struct agentx_handle *h, str done: if (varbind != NULL) ber_free_elements(varbind); - if (v) - free(v); + free(v); *idx = x; return (ret); } Index: usr.sbin/tcpdump/pfctl_osfp.c =================================================================== RCS file: /cvs/src/usr.sbin/tcpdump/pfctl_osfp.c,v retrieving revision 1.10 diff -u -p -r1.10 pfctl_osfp.c --- usr.sbin/tcpdump/pfctl_osfp.c 20 Jan 2015 18:26:58 -0000 1.10 +++ usr.sbin/tcpdump/pfctl_osfp.c 9 Sep 2015 15:38:53 -0000 @@ -113,16 +113,11 @@ pfctl_file_fingerprints(int dev, int opt buf[len -1] = '\n'; line = buf; lineno++; - if (class) - free(class); - if (version) - free(version); - if (subtype) - free(subtype); - if (desc) - free(desc); - if (tcpopts) - free(tcpopts); + free(class); + free(version); + free(subtype); + free(desc); + free(tcpopts); class = version = subtype = desc = tcpopts = NULL; memset(&fp, 0, sizeof(fp)); @@ -251,14 +246,10 @@ pfctl_file_fingerprints(int dev, int opt add_fingerprint(dev, opts, &fp); } - if (class) - free(class); - if (version) - free(version); - if (subtype) - free(subtype); - if (desc) - free(desc); + free(class); + free(version); + free(subtype); + free(desc); if (opts & PF_OPT_VERBOSE2) printf("Loaded %d passive OS fingerprints\n", Index: usr.sbin/tcpdump/privsep.c =================================================================== RCS file: /cvs/src/usr.sbin/tcpdump/privsep.c,v retrieving revision 1.35 diff -u -p -r1.35 privsep.c --- usr.sbin/tcpdump/privsep.c 21 Aug 2015 02:07:32 -0000 1.35 +++ usr.sbin/tcpdump/privsep.c 9 Sep 2015 15:38:53 -0000 @@ -579,10 +579,8 @@ impl_getlines(int fd) write_string(fd, buf); - if (lbuf != NULL) { - free(lbuf); - lbuf = NULL; - } + free(lbuf); + lbuf = NULL; } write_zero(fd); fclose(fp); Index: usr.sbin/ypbind/ypbind.c =================================================================== RCS file: /cvs/src/usr.sbin/ypbind/ypbind.c,v retrieving revision 1.64 diff -u -p -r1.64 ypbind.c --- usr.sbin/ypbind/ypbind.c 20 Aug 2015 22:39:30 -0000 1.64 +++ usr.sbin/ypbind/ypbind.c 9 Sep 2015 15:38:53 -0000 @@ -536,8 +536,7 @@ main(int argc, char *argv[]) extern void *__svc_fdset; if (fdsrp == NULL || fdsrl != __svc_fdsetsize) { - if (fdsrp) - free(fdsrp); + free(fdsrp); fdsrl = __svc_fdsetsize; width = __svc_fdsetsize; Index: usr.sbin/ypldap/aldap.c =================================================================== RCS file: /cvs/src/usr.sbin/ypldap/aldap.c,v retrieving revision 1.30 diff -u -p -r1.30 aldap.c --- usr.sbin/ypldap/aldap.c 30 Apr 2012 21:40:03 -0000 1.30 +++ usr.sbin/ypldap/aldap.c 9 Sep 2015 15:38:53 -0000 @@ -352,8 +352,7 @@ aldap_parse_page_control(struct ber_elem void aldap_freepage(struct aldap_page_control *page) { - if (page->cookie) - free(page->cookie); + free(page->cookie); free(page); } Index: usr.sbin/ypserv/revnetgroup/parse_netgroup.c =================================================================== RCS file: /cvs/src/usr.sbin/ypserv/revnetgroup/parse_netgroup.c,v retrieving revision 1.12 diff -u -p -r1.12 parse_netgroup.c --- usr.sbin/ypserv/revnetgroup/parse_netgroup.c 27 Oct 2009 23:59:58 -0000 1.12 +++ usr.sbin/ypserv/revnetgroup/parse_netgroup.c 9 Sep 2015 15:38:53 -0000 @@ -151,12 +151,9 @@ __endnetgrent(void) while (gp) { ogp = gp; gp = gp->ng_next; - if (ogp->ng_str[NG_HOST]) - free(ogp->ng_str[NG_HOST]); - if (ogp->ng_str[NG_USER]) - free(ogp->ng_str[NG_USER]); - if (ogp->ng_str[NG_DOM]) - free(ogp->ng_str[NG_DOM]); + free(ogp->ng_str[NG_HOST]); + free(ogp->ng_str[NG_USER]); + free(ogp->ng_str[NG_DOM]); free(ogp); } grouphead.gr = NULL; Index: usr.sbin/ypserv/ypserv/ypserv_db.c =================================================================== RCS file: /cvs/src/usr.sbin/ypserv/ypserv/ypserv_db.c,v retrieving revision 1.29 diff -u -p -r1.29 ypserv_db.c --- usr.sbin/ypserv/ypserv/ypserv_db.c 16 Jan 2015 06:40:23 -0000 1.29 +++ usr.sbin/ypserv/ypserv/ypserv_db.c 9 Sep 2015 15:38:54 -0000 @@ -301,8 +301,7 @@ ypdb_open_db(domainname domain, mapname if (d == NULL || d->domain == NULL) { yplog(" ypdb_open_db: MALLOC failed"); ypdb_close(db); - if (d) - free(d); + free(d); return(NULL); } LIST_INIT(&d->dmaps); @@ -320,8 +319,7 @@ ypdb_open_db(domainname domain, mapname if (m) m->map = strdup(map); if (m == NULL || m->map == NULL) { - if (m) - free(m); + free(m); yplog(" ypdb_open_db: MALLOC failed"); ypdb_close(db); return(NULL);