[PATCH 2 of 2] Core: simplified error handling in ngx_resolver_dup()

Tatsuhiko Kubo cubicdaiya at gmail.com
Sat Aug 2 03:30:48 UTC 2014


# HG changeset patch
# User Tatsuhiko Kubo <cubicdaiya at gmail.com>
# Date 1406949498 -32400
#      Sat Aug 02 12:18:18 2014 +0900
# Node ID 894e6e8803a1e580ac4af17cf10813f1bd20075b
# Parent  21d53d2ef2cd35967df5f788589e5470d650dad3
Core: simplified error handling in ngx_resolver_dup().

diff -r 21d53d2ef2cd -r 894e6e8803a1 src/core/ngx_resolver.c
--- a/src/core/ngx_resolver.c	Sat Aug 02 12:17:39 2014 +0900
+++ b/src/core/ngx_resolver.c	Sat Aug 02 12:18:18 2014 +0900
@@ -2888,12 +2888,10 @@ ngx_resolver_dup(ngx_resolver_t *r, void
 
     dst = ngx_resolver_alloc(r, size);
 
-    if (dst == NULL) {
-        return dst;
+    if (dst) {
+        ngx_memcpy(dst, src, size);
     }
 
-    ngx_memcpy(dst, src, size);
-
     return dst;
 }
 



More information about the nginx-devel mailing list