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; return NULL;
s_end = s_ptr + NUM; s_end = s_ptr + NUM;
s_pos = s_ptr + s_start; s_pos = s_ptr + s_start;
d_block = malloc(EDID1_LEN); d_block = calloc(1, EDID1_LEN);
if (!d_block) if (!d_block)
return NULL; return NULL;
d_pos = d_block; d_pos = d_block;

View File

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

View File

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