xfree86: small memory leaks fixes

A couple of memory leaks fixes and avoiding bit shifting on an
unitialized value.

[hdegoede@redhat.com: Split out some non free fixes in separate patches]
[hdegoede@redhat.com: Don't touch ancient (and weird) os/rpcauth.c code]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
David CARLIER 2016-09-23 14:17:12 +03:00 committed by Adam Jackson
parent d51cce7992
commit 127e0569ca
3 changed files with 5 additions and 2 deletions

View File

@ -149,7 +149,7 @@ GetEDID_DDC1(unsigned int *s_ptr)
return NULL;
s_end = s_ptr + NUM;
s_pos = s_ptr + s_start;
d_block = malloc(EDID1_LEN);
d_block = calloc(1, EDID1_LEN);
if (!d_block)
return NULL;
d_pos = d_block;

View File

@ -847,7 +847,7 @@ ms_get_drm_master_fd(ScrnInfoPtr pScrn)
if (pEnt->location.type == BUS_PCI) {
ms->PciInfo = xf86GetPciInfoForEntity(ms->pEnt->index);
if (ms->PciInfo) {
BusID = malloc(64);
BusID = XNFalloc(64);
sprintf(BusID, "PCI:%d:%d:%d",
#if XSERVER_LIBPCIACCESS
((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
@ -860,6 +860,7 @@ ms_get_drm_master_fd(ScrnInfoPtr pScrn)
);
}
ms->fd = drmOpen(NULL, BusID);
free(BusID);
}
else {
const char *devicename;

View File

@ -692,6 +692,8 @@ main(int argc, char *argv[])
if (o->fbmode)
print_fb_mode(m);
free(m);
return 0;
}