]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
add @wcawijngaards' review comments
authorTCY16 <tom@nlnetlabs.nl>
Mon, 26 Sep 2022 10:14:17 +0000 (12:14 +0200)
committerTCY16 <tom@nlnetlabs.nl>
Mon, 26 Sep 2022 10:14:17 +0000 (12:14 +0200)
util/data/msgreply.c
validator/validator.c

index 3a5308c42c8889c21594c3113c0a5f3aea10253b..3360f3175e68ec947f3d2868937e0dde4c8d27f7 100644 (file)
@@ -593,6 +593,7 @@ reply_info_parsedelete(struct reply_info* rep, struct alloc_cache* alloc)
        if (rep->reason_bogus_str_size) {
                free(rep->reason_bogus_str);
        }
+       free(rep);
 }
 
 int 
index 44e4932928838b6585eeae371febc9ce202ad533..f4c8242a8fef60ffc9540dd1c0a1c6dbc68c14cb 100644 (file)
@@ -2156,8 +2156,17 @@ processFinished(struct module_qstate* qstate, struct val_qstate* vq,
                                        size_t err_str_len = strlen(err_str);
 
                                        /* allocate space and store the error string and it's size*/
-                                       vq->orig_msg->rep->reason_bogus_str = malloc(sizeof(char) * (err_str_len + 1));
-                                       memcpy(vq->orig_msg->rep->reason_bogus_str, err_str, err_str_len + 1);
+                                       if (qstate->region) {
+                                               vq->orig_msg->rep->reason_bogus_str = regional_alloc(
+                                                       qstate->region,
+                                                       sizeof(char) * (err_str_len + 1));
+                                       } else {
+                                               vq->orig_msg->rep->reason_bogus_str = malloc(
+                                                       sizeof(char) * (err_str_len + 1));
+                                       }
+
+                                       memcpy(vq->orig_msg->rep->reason_bogus_str,
+                                               err_str, err_str_len + 1);
                                        vq->orig_msg->rep->reason_bogus_str_size = err_str_len;
                                }
                                free(err_str);