From 6fa7050b9e42cd321b174c7f7a68cf675a898766 Mon Sep 17 00:00:00 2001 From: Alex Hermann Date: Tue, 20 Oct 2020 09:46:13 +0200 Subject: [PATCH] core: Remove redundant check from (shm|pkg)_str_dup() Check for src->s is also done before the memory allocation. --- src/core/ut.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/core/ut.h b/src/core/ut.h index 6ef2e079bcf..c81fe08c8db 100644 --- a/src/core/ut.h +++ b/src/core/ut.h @@ -781,12 +781,6 @@ static inline int shm_str_dup(str* dst, const str* src) return -1; } - /* avoid memcpy from NULL source - undefined behaviour */ - if (src->s == NULL) { - LM_WARN("shm_str_dup fallback; skip memcpy for src->s == NULL\n"); - return 0; - } - memcpy(dst->s, src->s, dst->len); return 0; @@ -881,12 +875,6 @@ static inline int pkg_str_dup(str* dst, const str* src) return -1; } - /* avoid memcpy from NULL source - undefined behaviour */ - if (src->s == NULL) { - LM_WARN("pkg_str_dup fallback; skip memcpy for src->s == NULL\n"); - return 0; - } - memcpy(dst->s, src->s, dst->len); return 0;