[PATCH] Avoid memory leak on failure to allocate name during resolving
Bart Warmerdam
bartw at xs4all.nl
Mon Jun 19 06:00:37 UTC 2017
# HG changeset patch
# User Bart Warmerdam <bartw at xs4all.nl>
# Date 1497851445 -7200
# Mon Jun 19 07:50:45 2017 +0200
# Branch memleak_resolve_name
# Node ID dd8c5ef0483cf0abe6f9f88b4bb9ba681aec7be4
# Parent d1816a2696de8c2faa1cd913a151e5f62a8620f3
Avoid leak on error allocating name
diff -r d1816a2696de -r dd8c5ef0483c src/core/ngx_resolver.c
--- a/src/core/ngx_resolver.c Fri Jun 16 18:15:58 2017 +0300
+++ b/src/core/ngx_resolver.c Mon Jun 19 07:50:45 2017 +0200
@@ -443,7 +443,7 @@
name.data = ngx_resolver_alloc(r, name.len);
if (name.data == NULL) {
- return NGX_ERROR;
+ goto resolve_error;
}
if (slen == ctx->service.len) {
@@ -481,6 +481,7 @@
ngx_resolver_free(r, ctx->event);
}
+resolve_error:
ngx_resolver_free(r, ctx);
return NGX_ERROR;
More information about the nginx-devel
mailing list