|
Bugzilla – Full Text Bug Listing |
| Summary: | xdm greeter - unhandled error case for malloc | ||
|---|---|---|---|
| Product: | [openSUSE] SUSE LINUX 10.0 | Reporter: | Jan Engelhardt <jengelh> |
| Component: | X.Org | Assignee: | Matthias Hopf <mhopf> |
| Status: | VERIFIED FIXED | QA Contact: | Stefan Dirsch <sndirsch> |
| Severity: | Normal | ||
| Priority: | P3 - Medium | CC: | eich, sndirsch, werner |
| Version: | RC 4 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Found By: | Beta-Customer | Services Priority: | |
| Business Priority: | Blocker: | --- | |
| Marketing QA Status: | --- | IT Deployment: | --- |
| Attachments: | Patch to catch realloc=>NULL and malloc=>NULL cases | ||
|
Description
Jan Engelhardt
2006-01-12 21:45:58 UTC
Created attachment 63188 [details]
Patch to catch realloc=>NULL and malloc=>NULL cases
> + if((reply = realloc(reply, size)) == NULL) {
> + free(reply);
free(NULL) ?
Hm, right. Should have been something like:
void *r2 = reply;
if((reply = realloc(reply, ...) == NULL)
free(r2);
How meaningful is free()ing anyway? Does not xdm greet exit somehow anyway and
therefore automatically have any leaking memory relinquished? That would save
us the free()s.
- > How meaningful is free()ing anyway? Does not xdm greet exit somehow anyway
> and therefore automatically have any leaking memory relinquished? That would
> save us the free()s.
At least it's not done at this location in the original code.
I'll check the code upstream. Thanks! Bailing out at an out-of-memory seems to be something that we should put upstream - even if this is just fixing a corner case. Fixed upstream. comment #2: free(reply/NULL) is allowed, though it does not make much sense when the argument is known to be NULL, of course. |