Commit ebc49a1e authored by Lubos Slovak's avatar Lubos Slovak

Fixed NULL checks.

refs #1665
parent e8fe6aea
......@@ -697,11 +697,12 @@ static unsigned long calculate_crc(FILE *f)
int knot_zload_open(zloader_t **dst, const char *filename)
{
*dst = 0;
if (!dst || !filename) {
return KNOT_EBADARG;
}
*dst = 0;
fread_wrapper = fread_safe_from_file;
/* Open file for binary read. */
......@@ -893,12 +894,13 @@ static knot_dname_t **create_dname_array(FILE *f, uint max_id)
knot_dname_t **array =
malloc(sizeof(knot_dname_t *) * ( max_id + 1));
memset(array, 0, sizeof(knot_dname_t *) * (max_id + 1));
if (array == NULL) {
ERR_ALLOC_FAILED;
return NULL;
}
memset(array, 0, sizeof(knot_dname_t *) * (max_id + 1));
for (uint i = 0; i < max_id - 1; i++) {
knot_dname_t *read_dname = read_dname_with_id(f);
if (read_dname == NULL) {
......
......@@ -904,8 +904,11 @@ dbg_xfrin_exec(
static int xfrin_parse_first_rr(knot_packet_t **packet, const uint8_t *pkt,
size_t size, knot_rrset_t **rr)
{
assert(packet != NULL);
assert(rr != NULL);
*packet = knot_packet_new(KNOT_PACKET_PREALLOC_NONE);
if (packet == NULL) {
if (*packet == NULL) {
dbg_xfrin("Could not create packet structure.\n");
return KNOT_ENOMEM;
}
......@@ -3124,6 +3127,11 @@ int xfrin_apply_changesets(knot_zone_t *zone,
return ret;
}
/*!
* \todo Maybe check also all mandatory semantic checks, e.g. CNAME
* and DNAME children.
*/
dbg_xfrin("Switching zone contents.\n");
dbg_xfrin_verb("Old contents apex: %p, new apex: %p\n",
old_contents->apex, contents_copy->apex);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment