Commit c84afb5b authored by Libor Peltan's avatar Libor Peltan

avoid calling memcpy(ptr, NULL, 0)

parent c870aaf1
......@@ -199,7 +199,9 @@ int kasp_zone_append(knot_kasp_zone_t *zone, const knot_kasp_key_t *appkey)
if (!new_keys) {
return KNOT_ENOMEM;
}
memcpy(new_keys, zone->keys, zone->num_keys * sizeof(*new_keys));
if (zone->num_keys > 0) {
memcpy(new_keys, zone->keys, zone->num_keys * sizeof(*new_keys));
}
memcpy(&new_keys[new_num_keys - 1], appkey, sizeof(*appkey));
free(zone->keys);
zone->keys = new_keys;
......
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