diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2015-12-03 11:46:26 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2015-12-03 11:46:26 +0000 |
commit | 5d1cc1f2e49619d168b935c6595ad7107ec10136 (patch) | |
tree | ce3308b76a4380ec20b376bec6fdf7278e4e4919 /usr.sbin | |
parent | e7a2dcbf50908ca990c15fb8c4c872f6c6abe488 (diff) |
Remove unnecessary NULL checks before free().
From Jan Schreiber
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/httpd/httpd.c | 6 | ||||
-rw-r--r-- | usr.sbin/httpd/server_http.c | 34 |
2 files changed, 16 insertions, 24 deletions
diff --git a/usr.sbin/httpd/httpd.c b/usr.sbin/httpd/httpd.c index 22575c51ad7..0dc9409f6d7 100644 --- a/usr.sbin/httpd/httpd.c +++ b/usr.sbin/httpd/httpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.c,v 1.52 2015/12/03 07:01:29 deraadt Exp $ */ +/* $OpenBSD: httpd.c,v 1.53 2015/12/03 11:46:25 reyk Exp $ */ /* * Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org> @@ -1197,8 +1197,8 @@ void media_delete(struct mediatypes *types, struct media_type *media) { RB_REMOVE(mediatypes, types, media); - if (media->media_encoding != NULL) - free(media->media_encoding); + + free(media->media_encoding); free(media); } diff --git a/usr.sbin/httpd/server_http.c b/usr.sbin/httpd/server_http.c index d8cf256be9e..fdf39f3cd63 100644 --- a/usr.sbin/httpd/server_http.c +++ b/usr.sbin/httpd/server_http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server_http.c,v 1.101 2015/10/13 08:33:06 sunil Exp $ */ +/* $OpenBSD: server_http.c,v 1.102 2015/12/03 11:46:25 reyk Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org> @@ -102,26 +102,18 @@ server_httpdesc_free(struct http_descriptor *desc) { if (desc == NULL) return; - if (desc->http_path != NULL) { - free(desc->http_path); - desc->http_path = NULL; - } - if (desc->http_path_alias != NULL) { - free(desc->http_path_alias); - desc->http_path_alias = NULL; - } - if (desc->http_query != NULL) { - free(desc->http_query); - desc->http_query = NULL; - } - if (desc->http_version != NULL) { - free(desc->http_version); - desc->http_version = NULL; - } - if (desc->http_host != NULL) { - free(desc->http_host); - desc->http_host = NULL; - } + + free(desc->http_path); + desc->http_path = NULL; + free(desc->http_path_alias); + desc->http_path_alias = NULL; + free(desc->http_query); + desc->http_query = NULL; + free(desc->http_version); + desc->http_version = NULL; + free(desc->http_host); + desc->http_host = NULL; + kv_purge(&desc->http_headers); desc->http_lastheader = NULL; desc->http_method = 0; |