When compression support is off, there's no point in duplicating the
name string. Hence, don't do it.
saved_size = p->size;
while (*name) {
- _cleanup_free_ char *s = NULL;
+ const char *z = name;
char label[DNS_LABEL_MAX];
size_t n = 0;
int k;
}
}
- s = strdup(name);
- if (!s) {
- r = -ENOMEM;
- goto fail;
- }
-
r = dns_label_unescape(&name, label, sizeof(label));
if (r < 0)
goto fail;
goto fail;
if (allow_compression) {
+ _cleanup_free_ char *s = NULL;
+
+ s = strdup(z);
+ if (!s) {
+ r = -ENOMEM;
+ goto fail;
+ }
+
r = hashmap_ensure_allocated(&p->names, &dns_name_hash_ops);
if (r < 0)
goto fail;