Bugzilla – Bug 142954
xdm greeter - unhandled error case for malloc
Last modified: 2006-12-02 17:06:54 UTC
In case of an out-of-memory condition, xdm's greeter will probably segfault. Here is a patch to fix the potential segfault.
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.