[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnurl] 50/222: mime: make Curl_mime_duppart() assert if called without
From: |
gnunet |
Subject: |
[gnurl] 50/222: mime: make Curl_mime_duppart() assert if called without valid dst |
Date: |
Thu, 07 Nov 2019 00:09:06 +0100 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 2ba62322a74a408e90b53afb185ba555a157ecb3
Author: Daniel Stenberg <address@hidden>
AuthorDate: Thu Sep 19 10:06:01 2019 +0200
mime: make Curl_mime_duppart() assert if called without valid dst
Fixes warning detected by PVS-Studio
Fixes #4374
---
lib/mime.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/mime.c b/lib/mime.c
index 0fb3ae81c..081e51e50 100644
--- a/lib/mime.c
+++ b/lib/mime.c
@@ -1135,6 +1135,8 @@ CURLcode Curl_mime_duppart(curl_mimepart *dst, const
curl_mimepart *src)
const curl_mimepart *s;
CURLcode res = CURLE_OK;
+ DEBUGASSERT(dst);
+
/* Duplicate content. */
switch(src->kind) {
case MIMEKIND_NONE:
@@ -1184,20 +1186,18 @@ CURLcode Curl_mime_duppart(curl_mimepart *dst, const
curl_mimepart *src)
}
}
- /* Duplicate other fields. */
- if(dst != NULL)
+ if(!res) {
+ /* Duplicate other fields. */
dst->encoder = src->encoder;
- else
- res = CURLE_WRITE_ERROR;
- if(!res)
res = curl_mime_type(dst, src->mimetype);
+ }
if(!res)
res = curl_mime_name(dst, src->name);
if(!res)
res = curl_mime_filename(dst, src->filename);
/* If an error occurred, rollback. */
- if(res && dst)
+ if(res)
Curl_mime_cleanpart(dst);
return res;
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [gnurl] 55/222: libssh2: part of conditional expression is always true: !result, (continued)
- [gnurl] 55/222: libssh2: part of conditional expression is always true: !result, gnunet, 2019/11/06
- [gnurl] 53/222: urlapi: 'scheme' is always true, gnunet, 2019/11/06
- [gnurl] 58/222: tool_operate: removed unused variable 'done', gnunet, 2019/11/06
- [gnurl] 59/222: travis: use go master, gnunet, 2019/11/06
- [gnurl] 61/222: ngtcp2: compile with latest ngtcp2 + nghttp3 draft-23, gnunet, 2019/11/06
- [gnurl] 49/222: http_proxy: part of conditional expression is always true: !error, gnunet, 2019/11/06
- [gnurl] 60/222: THANKS-filter: deal with my typos 'Jat' => 'Jay', gnunet, 2019/11/06
- [gnurl] 64/222: FTP: FTPFILE_NOCWD: avoid redundant CWDs, gnunet, 2019/11/06
- [gnurl] 68/222: altsvc: both backends run h3-23 now, gnunet, 2019/11/06
- [gnurl] 48/222: imap: merged two case-branches performing the same action, gnunet, 2019/11/06
- [gnurl] 50/222: mime: make Curl_mime_duppart() assert if called without valid dst,
gnunet <=
- [gnurl] 57/222: tool_operate: Expression 'config->resume_from' is always true, gnunet, 2019/11/06
- [gnurl] 67/222: http: fix warning on conversion from int to bit, gnunet, 2019/11/06
- [gnurl] 81/222: libssh: The expression is excessive or contains a misprint, gnunet, 2019/11/06
- [gnurl] 51/222: setopt: store CURLOPT_RTSP_SERVER_CSEQ correctly, gnunet, 2019/11/06
- [gnurl] 52/222: urlapi: part of conditional expression is always true: (relurl[0] == '/'), gnunet, 2019/11/06
- [gnurl] 56/222: tool_getparam: remove duplicate switch case, gnunet, 2019/11/06
- [gnurl] 65/222: appveyor: upgrade VS2017 to VS2019, gnunet, 2019/11/06
- [gnurl] 62/222: urlapi: avoid index underflow for short ipv6 hostnames, gnunet, 2019/11/06
- [gnurl] 63/222: cookie: pass in the correct cookie amount to qsort(), gnunet, 2019/11/06
- [gnurl] 66/222: urldata: use 'bool' for the bit type on MSVC compilers, gnunet, 2019/11/06