Donat Zenichev
de0e31eaeb
MT#56493 Fix some defects discovered by CoverityScan
Fix the following defect:
*** CID 1534609: (DEADCODE)
/recording-daemon/notify.c: 110 in do_notify()
104 part = curl_mime_addpart(mime);
105 curl_mime_name(part, "ngfile");
106 if (ret != CURLE_OK)
107 goto fail;
108 curl_mime_filedata(part, req->full_filename_path);
109 if (ret != CURLE_OK)
>>> CID 1534609: (DEADCODE)
>>> Execution cannot reach this statement: "goto fail;".
110 goto fail;
111 curl_easy_setopt(c, CURLOPT_MIMEPOST, mime);
112 if (ret != CURLE_OK)
113 goto fail;
114 }
115
/recording-daemon/notify.c: 113 in do_notify()
107 goto fail;
108 curl_mime_filedata(part, req->full_filename_path);
109 if (ret != CURLE_OK)
110 goto fail;
111 curl_easy_setopt(c, CURLOPT_MIMEPOST, mime);
112 if (ret != CURLE_OK)
>>> CID 1534609: (DEADCODE)
>>> Execution cannot reach this statement: "goto fail;".
113 goto fail;
114 }
115
116 err = "performing request";
117 ret = curl_easy_perform(c);
118 if (ret != CURLE_OK)
/recording-daemon/notify.c: 107 in do_notify()
101 err = "initializing curl mime&part";
102 curl_mimepart *part;
103 mime = curl_mime_init(c);
104 part = curl_mime_addpart(mime);
105 curl_mime_name(part, "ngfile");
106 if (ret != CURLE_OK)
>>> CID 1534609: (DEADCODE)
>>> Execution cannot reach this statement: "goto fail;".
107 goto fail;
108 curl_mime_filedata(part, req->full_filename_path);
109 if (ret != CURLE_OK)
110 goto fail;
111 curl_easy_setopt(c, CURLOPT_MIMEPOST, mime);
112 if (ret != CURLE_OK)
*** CID 1534608: Error handling issues (CHECKED_RETURN)
/recording-daemon/notify.c: 108 in do_notify()
102 curl_mimepart *part;
103 mime = curl_mime_init(c);
104 part = curl_mime_addpart(mime);
105 curl_mime_name(part, "ngfile");
106 if (ret != CURLE_OK)
107 goto fail;
>>> CID 1534608: Error handling issues (CHECKED_RETURN)
>>> Calling "curl_mime_filedata(part, req->full_filename_path)" without checking return value.
>>> This library function may fail and return an error code.
108 curl_mime_filedata(part, req->full_filename_path);
109 if (ret != CURLE_OK)
110 goto fail;
111 curl_easy_setopt(c, CURLOPT_MIMEPOST, mime);
112 if (ret != CURLE_OK)
113 goto fail;
*** CID 1534607: Error handling issues (CHECKED_RETURN)
/recording-daemon/notify.c: 111 in do_notify()
105 curl_mime_name(part, "ngfile");
106 if (ret != CURLE_OK)
107 goto fail;
108 curl_mime_filedata(part, req->full_filename_path);
109 if (ret != CURLE_OK)
110 goto fail;
>>> CID 1534607: Error handling issues (CHECKED_RETURN)
>>> Calling "curl_easy_setopt(c, _curl_opt, mime)" without checking return value.
>>> This library function may fail and return an error code.
111 curl_easy_setopt(c, CURLOPT_MIMEPOST, mime);
112 if (ret != CURLE_OK)
113 goto fail;
114 }
115
116 err = "performing request";
Additionally, refactor the code in the do_notify() slightly.
Change-Id: I80dd373f4ced92d90475dbcca21ee2d62f06e57e
3 years ago