diff options
author | Erwin Lansing <erwin@FreeBSD.org> | 2013-07-24 07:12:55 +0000 |
---|---|---|
committer | Erwin Lansing <erwin@FreeBSD.org> | 2013-07-24 07:12:55 +0000 |
commit | 6f34f6a389ca8199c4b20c17f62d7d924baef7fb (patch) | |
tree | e392027bf54f7a1fd2a6f3a16ecb4487844b44e9 /lib/export/samples/sample-request.c | |
parent | 650b026006ec14e630f658a0f877099ec38b660b (diff) |
Notes
Diffstat (limited to 'lib/export/samples/sample-request.c')
-rw-r--r-- | lib/export/samples/sample-request.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/export/samples/sample-request.c b/lib/export/samples/sample-request.c index d5d2312e30d1..07baf3950785 100644 --- a/lib/export/samples/sample-request.c +++ b/lib/export/samples/sample-request.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009, 2012, 2013 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -77,9 +77,12 @@ make_querymessage(dns_message_t *message, const char *namestr, isc_buffer_t b; size_t namelen; + REQUIRE(message != NULL); + REQUIRE(namestr != NULL); + /* Construct qname */ namelen = strlen(namestr); - isc_buffer_init(&b, namestr, namelen); + isc_buffer_constinit(&b, namestr, namelen); isc_buffer_add(&b, namelen); dns_fixedname_init(&fixedqname); qname0 = dns_fixedname_name(&fixedqname); @@ -115,8 +118,7 @@ make_querymessage(dns_message_t *message, const char *namestr, dns_message_puttempname(message, &qname); if (qrdataset != NULL) dns_message_puttemprdataset(message, &qrdataset); - if (message != NULL) - dns_message_destroy(&message); + dns_message_destroy(&message); return (result); } @@ -259,5 +261,5 @@ main(int argc, char *argv[]) { dns_client_destroy(&client); dns_lib_shutdown(); - exit(0); + return (0); } |