Remove bad code from DoShowOptions (Xorg -showopts handler)
When we want to print a string, it's okay to just print it. We don't need to first allocate a buffer 2 bytes bigger than the string, copy the entire string unmodified to the buffer, print the buffer, and then leak the buffer (though we AbortDDX 8 lines later, and then just in case we survived that, call exit as well, so the leak is short lived, just oh so pointless). Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
parent
71a89d9733
commit
43fa127426
|
@ -107,16 +107,8 @@ void DoShowOptions (void) {
|
|||
i,xf86DriverList[i]->driverName,vers->vendor
|
||||
);
|
||||
for (p = pOption; p->name != NULL; p++) {
|
||||
const char *opttype = optionTypeToSting(p->type);
|
||||
/* XXX: Why overallocate by 2 bytes?
|
||||
* Otherwise, this would be strdup()
|
||||
*/
|
||||
char *optname = malloc(strlen(p->name) + 2 + 1);
|
||||
if (!optname) {
|
||||
continue;
|
||||
}
|
||||
sprintf(optname, "%s", p->name);
|
||||
ErrorF ("\t%s:%s\n", optname,opttype);
|
||||
ErrorF ("\t%s:%s\n", p->name,
|
||||
optionTypeToSting(p->type));
|
||||
}
|
||||
ErrorF ("}\n");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user