Closed
Bug 322908
Opened 19 years ago
Closed 19 years ago
ASSERTION: NS_Alloc of size 0: 'size'
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha1
People
(Reporter: martijn.martijn, Assigned: darin.moz)
References
()
Details
(Keywords: assertion, testcase)
Attachments
(1 file, 1 obsolete file)
1.18 KB,
patch
|
benjamin
:
review+
|
Details | Diff | Splinter Review |
In an updated trunk build, I get this assertion when clicking on the submit button in the testcase:
###!!! ASSERTION: NS_Alloc of size 0: 'size', file c:/mozilla/mozilla/xpcom/base
/nsMemoryImpl.cpp, line 335
I don't get this with a debug build from a few weeks earlier.
![]() |
||
Comment 1•19 years ago
|
||
This is fallout from bug 318193 -- the form code is calling NS_NewByteInputStream and passing it an empty string (which seems perfectly reasonable). nsStringInputStream::SetData then calls NS_Alloc with the length of the string, which is 0. That seems wrong, but I'm not sure what the right thing to do would be; we can't use null for the data.
Assignee: nobody → dougt
Component: Layout: Form Controls → XPCOM
Flags: blocking1.9a1?
OS: Windows XP → All
QA Contact: layout.form-controls → xpcom
Hardware: PC → All
Assignee | ||
Comment 2•19 years ago
|
||
The MSDN documentation for malloc says the following:
"If size is 0, malloc allocates a zero-length item in the heap and returns a valid pointer to that item."
So, why is NS_Alloc asserting that size should not be zero? I think the assertion is bogus.
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.9alpha
Assignee | ||
Comment 3•19 years ago
|
||
Remove bogus assertions: malloc(0) and realloc(ptr, 0) are both valid.
Attachment #208096 -
Flags: review?(benjamin)
Assignee | ||
Comment 4•19 years ago
|
||
Whoops.. we shouldn't be calling FlushMemory if NS_Realloc was used to free memory!
Attachment #208096 -
Attachment is obsolete: true
Attachment #208097 -
Flags: review?(benjamin)
Attachment #208096 -
Flags: review?(benjamin)
Updated•19 years ago
|
Attachment #208097 -
Flags: review?(benjamin) → review+
Assignee | ||
Comment 5•19 years ago
|
||
fixed-on-trunk
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Updated•19 years ago
|
Flags: blocking1.9a1?
You need to log in
before you can comment on or make changes to this bug.
Description
•