Closed Bug 1308884 Opened 3 years ago Closed 3 years ago

[Static Analysis][Missing varargs init or cleanup] In function ReportOnCallerUTF8

Categories

(Core :: XPConnect, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: andi, Assigned: andi)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: CID 1373500, CID 1373499)

Attachments

(1 file)

The Static Analysis tool Coverity detected that va_end is not called in function that uses va_list with va_start:

>>    va_list ap;
>>    va_start(ap, format);
>>
>>    char* buf = JS_vsmprintf(format, ap);
>>    if (!buf) {
>>        return NS_ERROR_OUT_OF_MEMORY;
>>    }
>>
>>    JS_ReportErrorUTF8(callerContext, "%s", buf);
>>    JS_smprintf_free(buf);
>>
>>    return NS_OK;

va_end(ap) should be called on if branch but also on the normal return path.
Attachment #8799366 - Flags: review?(bobbyholley)
Comment on attachment 8799366 [details]
Bug 1308884 - clean return from functions that use variable number of arguments.

https://reviewboard.mozilla.org/r/84560/#review83204
Attachment #8799366 - Flags: review?(bobbyholley) → review+
Pushed by bpostelnicu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/68706d567be6
clean return from functions that use variable number of arguments. r=bholley
https://hg.mozilla.org/mozilla-central/rev/68706d567be6
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.