Open
Bug 1279542
Opened 10 years ago
Updated 3 months ago
(coverity) resource leak: mailnews/mime/src/mimei.cpp: |hdrs| is not released on early error return.
Categories
(MailNews Core :: MIME, defect)
MailNews Core
MIME
Tracking
(Not tracked)
NEW
People
(Reporter: ishikawa, Unassigned)
References
(Blocks 1 open bug, )
Details
(Keywords: coverity, Whiteboard: CID 1137487)
Coverity found this:
5. Condition clazz->initialize, taking false branch
234 NS_ASSERTION(clazz->initialize && clazz->finalize, "1.1 <rhp@netscape.com> 19 Mar 1999 12:00");
235
6. Condition hdrs, taking true branch
236 if (hdrs)
237 {
7. alloc_fn: Storage is returned from allocation function MimeHeaders_copy. [show details]
8. var_assign: Assigning: hdrs = storage returned from MimeHeaders_copy(hdrs).
238 hdrs = MimeHeaders_copy (hdrs);
9. Condition !hdrs, taking false branch
239 if (!hdrs) return 0;
240 }
241
242 object = (MimeObject *) PR_MALLOC(size);
10. Condition !object, taking true branch
CID 1137487 (#1 of 1): Resource leak (RESOURCE_LEAK)11. leaked_storage: Returning without freeing hdrs leaks the storage that it points to.
243 if (!object) return 0;
244
Observation:
Trying to release memory objects allocated within MimeHeaders_copy (hdrs) seems to be tricky because a tree has been created within.
I think it is easier to call MimeHeaders_copy() AFTER |object| is successfully allocated.
Then there is no need for freeing |hdrs| in this function.
Updated•4 years ago
|
Severity: normal → S3
Updated•3 months ago
|
Blocks: tb-coverity-analysis
Updated•3 months ago
|
No longer blocks: coverity-analysis
You need to log in
before you can comment on or make changes to this bug.
Description
•