]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
free memory in error case
authorBoris VANHOOF <boris.vanhoof@softathome.com>
Tue, 23 May 2023 07:23:03 +0000 (09:23 +0200)
committerBoris VANHOOF <boris.vanhoof@softathome.com>
Tue, 23 May 2023 07:23:03 +0000 (09:23 +0200)
services/mesh.c

index d7323bf58482467baa3591e4fa0e7ac14a98c96c..f9a44fd5eec7d5b3e76d332fb8cd6c0d2b0ca2b0 100644 (file)
@@ -456,13 +456,14 @@ void mesh_new_client(struct mesh_area* mesh, struct query_info* qinfo,
                        s->s.edns_opts_front_in = edns_opt_copy_region(edns->opt_list_in,
                                s->s.region);
                        if(!s->s.edns_opts_front_in) {
-                               log_err("mesh_state_create: out of memory; SERVFAIL");
+                               log_err("edns_opt_copy_region: out of memory; SERVFAIL");
                                if(!inplace_cb_reply_servfail_call(mesh->env, qinfo, NULL,
                                        NULL, LDNS_RCODE_SERVFAIL, edns, rep, mesh->env->scratch, mesh->env->now_tv))
                                                edns->opt_list_inplace_cb_out = NULL;
                                error_encode(r_buffer, LDNS_RCODE_SERVFAIL,
                                        qinfo, qid, qflags, edns);
                                comm_point_send_reply(rep);
+                               mesh_state_delete(&s->s);
                                return;
                        }
                }
@@ -575,6 +576,7 @@ mesh_new_callback(struct mesh_area* mesh, struct query_info* qinfo,
                        s->s.edns_opts_front_in = edns_opt_copy_region(edns->opt_list_in,
                                s->s.region);
                        if(!s->s.edns_opts_front_in) {
+                               mesh_state_delete(&s->s);
                                return 0;
                        }
                }