Welcome! Log In Create A New Profile

Advanced

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

August 01, 2014 11:32PM
# HG changeset patch
# User Tatsuhiko Kubo <cubicdaiya@gmail.com>
# Date 1406949459 -32400
# Sat Aug 02 12:17:39 2014 +0900
# Node ID 21d53d2ef2cd35967df5f788589e5470d650dad3
# Parent f87afb46ccd26fccc7ed55ca8a7ef89c6256c3f2
Core: simplified error handling in ngx_pstrdup().

diff -r f87afb46ccd2 -r 21d53d2ef2cd src/core/ngx_string.c
--- a/src/core/ngx_string.c Fri Aug 01 20:04:14 2014 +0900
+++ b/src/core/ngx_string.c Sat Aug 02 12:17:39 2014 +0900
@@ -59,12 +59,10 @@ ngx_pstrdup(ngx_pool_t *pool, ngx_str_t
u_char *dst;

dst = ngx_pnalloc(pool, src->len);
- if (dst == NULL) {
- return NULL;
+ if (dst) {
+ ngx_memcpy(dst, src->data, src->len);
}

- ngx_memcpy(dst, src->data, src->len);
-
return dst;
}


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

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

cubicdaiya 798 August 01, 2014 11:32PM

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

cubicdaiya 438 August 01, 2014 11:32PM

Re: [PATCH 1 of 2] Core: simplified error handling in ngx_pstrdup()

Maxim Dounin 345 August 03, 2014 04:24PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 130
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready