diff options
author | Julien Cristau <jcristau@debian.org> | 2011-02-27 15:49:12 +0100 |
---|---|---|
committer | Julien Cristau <jcristau@debian.org> | 2011-02-27 16:00:54 +0100 |
commit | b20cfa3d4f531b612a28ea88e5f5a6b1df183ea0 (patch) | |
tree | 8efe0b57a8c97f777599e649610af9b16237b79d | |
parent | 312540ac447acaf80db7e341aa75f90f3e821438 (diff) |
Replace calls to xalloc/xcalloc/xfree with malloc/calloc/free
Also don't check for NULL before calling free().
Signed-off-by: Julien Cristau <jcristau@debian.org>
-rw-r--r-- | src/smi_crtc.c | 4 | ||||
-rw-r--r-- | src/smi_driver.c | 20 | ||||
-rw-r--r-- | src/smi_output.c | 2 | ||||
-rw-r--r-- | src/smi_video.c | 46 |
4 files changed, 35 insertions, 37 deletions
diff --git a/src/smi_crtc.c b/src/smi_crtc.c index 2bcdc0a..e82f2d8 100644 --- a/src/smi_crtc.c +++ b/src/smi_crtc.c @@ -170,8 +170,8 @@ SMI_CrtcDestroy (xf86CrtcPtr crtc) { ENTER(); - xfree(SMICRTC(crtc)); - xfree(crtc->funcs); + free(SMICRTC(crtc)); + free((xf86CrtcFuncsPtr)crtc->funcs); LEAVE(); } diff --git a/src/smi_driver.c b/src/smi_driver.c index 093c87d..9c10e46 100644 --- a/src/smi_driver.c +++ b/src/smi_driver.c @@ -281,9 +281,9 @@ SMI_FreeRec(ScrnInfoPtr pScrn) ENTER(); if (pSmi) { - xfree(pSmi->save); - xfree(pSmi->mode); - xfree(pScrn->driverPrivate); + free(pSmi->save); + free(pSmi->mode); + free(pScrn->driverPrivate); pScrn->driverPrivate = NULL; } @@ -338,7 +338,7 @@ SMI_Probe(DriverPtr drv, int flags) numDevSections, drv, &usedChips); /* Free it since we don't need that list after this */ - xfree(devSections); + free(devSections); if (numUsed <= 0) LEAVE(FALSE); @@ -364,14 +364,14 @@ SMI_Probe(DriverPtr drv, int flags) if ((pEnt = xf86GetEntityInfo(usedChips[i]))) { pScrn->EnterVT = SMI_EnterVT; pScrn->LeaveVT = SMI_LeaveVT; - xfree(pEnt); + free(pEnt); } pScrn->FreeScreen = SMI_FreeScreen; foundScreen = TRUE; } } } - xfree(usedChips); + free(usedChips); LEAVE(foundScreen); } @@ -421,7 +421,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) } if (pEnt->location.type != BUS_PCI) { - xfree(pEnt); + free(pEnt); SMI_FreeRec(pScrn); LEAVE(FALSE); } @@ -519,7 +519,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) } /* Process the options */ - if (!(pSmi->Options = xalloc(sizeof(SMIOptions)))) + if (!(pSmi->Options = malloc(sizeof(SMIOptions)))) LEAVE(FALSE); memcpy(pSmi->Options, SMIOptions, sizeof(SMIOptions)); @@ -662,7 +662,7 @@ SMI_PreInit(ScrnInfoPtr pScrn, int flags) } else pSmi->ChipRev = PCI_DEV_REVISION(pSmi->PciInfo); - xfree(pEnt); + free(pEnt); /* * This shouldn't happen because such problems should be caught in @@ -1858,7 +1858,7 @@ SMI_CloseScreen(int scrnIndex, ScreenPtr pScreen) pSmi->pInt10 = NULL; } if (pSmi->ptrAdaptor != NULL) { - xfree(pSmi->ptrAdaptor); + free(pSmi->ptrAdaptor); } if (pSmi->BlockHandler != NULL) { pScreen->BlockHandler = pSmi->BlockHandler; diff --git a/src/smi_output.c b/src/smi_output.c index bbc3f5c..faf6a32 100644 --- a/src/smi_output.c +++ b/src/smi_output.c @@ -156,7 +156,7 @@ SMI_OutputDestroy(xf86OutputPtr output) { ENTER(); - xfree(output->funcs); + free((xf86OutputFuncsPtr)output->funcs); LEAVE(); } diff --git a/src/smi_video.c b/src/smi_video.c index 57587ac..b4511b8 100644 --- a/src/smi_video.c +++ b/src/smi_video.c @@ -520,7 +520,7 @@ SMI_AddEncoding(XF86VideoEncodingPtr enc, int i, input_string = VideoInputs[input].name; sprintf(channel_string, "%d", channel); enc[i].id = i; - enc[i].name = xalloc(strlen(norm_string) + + enc[i].name = malloc(strlen(norm_string) + strlen(input_string) + strlen(channel_string)+3); if (NULL == enc[i].name) @@ -547,22 +547,22 @@ SMI_BuildEncodings(SMI_PortPtr p) ENTER(); /* allocate memory for encoding array */ - p->enc = xalloc(sizeof(XF86VideoEncodingRec) * N_ENCODINGS); + p->enc = malloc(sizeof(XF86VideoEncodingRec) * N_ENCODINGS); if (NULL == p->enc) goto fail; memset(p->enc,0,sizeof(XF86VideoEncodingRec) * N_ENCODINGS); /* allocate memory for video norm array */ - p->norm = xalloc(sizeof(int) * N_ENCODINGS); + p->norm = malloc(sizeof(int) * N_ENCODINGS); if (NULL == p->norm) goto fail; memset(p->norm,0,sizeof(int) * N_ENCODINGS); /* allocate memory for video input format array */ - p->input = xalloc(sizeof(int) * N_ENCODINGS); + p->input = malloc(sizeof(int) * N_ENCODINGS); if (NULL == p->input) goto fail; memset(p->input,0,sizeof(int) * N_ENCODINGS); /* allocate memory for video channel number array */ - p->channel = xalloc(sizeof(int) * N_ENCODINGS); + p->channel = malloc(sizeof(int) * N_ENCODINGS); if (NULL == p->channel) goto fail; memset(p->channel,0,sizeof(int) * N_ENCODINGS); @@ -590,13 +590,13 @@ SMI_BuildEncodings(SMI_PortPtr p) LEAVE(); fail: - if (p->input) xfree(p->input); + free(p->input); p->input = NULL; - if (p->norm) xfree(p->norm); + free(p->norm); p->norm = NULL; - if (p->channel) xfree(p->channel); + free(p->channel); p->channel = NULL; - if (p->enc) xfree(p->enc); + free(p->enc); p->enc = NULL; p->nenc = 0; LEAVE(); @@ -632,7 +632,7 @@ SMI_InitVideo(ScreenPtr pScreen) numAdaptors = 1; ptrAdaptors = &newAdaptor; } else { - newAdaptors = xalloc((numAdaptors + 1) * + newAdaptors = malloc((numAdaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); if (newAdaptors != NULL) { memcpy(newAdaptors, ptrAdaptors, @@ -648,9 +648,7 @@ SMI_InitVideo(ScreenPtr pScreen) xf86XVScreenInit(pScreen, ptrAdaptors, numAdaptors); } - if (newAdaptors != NULL) { - xfree(newAdaptors); - } + free(newAdaptors); LEAVE(); } @@ -824,7 +822,7 @@ SMI_SetupVideo(ScreenPtr pScreen) ENTER(); - ptrAdaptor = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + ptrAdaptor = calloc(1, sizeof(XF86VideoAdaptorRec) + sizeof(DevUnion) + sizeof(SMI_PortRec)); if (ptrAdaptor == NULL) LEAVE(NULL); @@ -2164,7 +2162,7 @@ SMI_InitOffscreenImages( ENTER(); - offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)); + offscreenImages = malloc(sizeof(XF86OffscreenImageRec)); if (offscreenImages == NULL) { LEAVE(); } @@ -2377,22 +2375,22 @@ SMI_AllocSurface( if (offset == 0) LEAVE(BadAlloc); - surface->pitches = xalloc(sizeof(int)); + surface->pitches = malloc(sizeof(int)); if (surface->pitches == NULL) { SMI_FreeMemory(pScrn, surface_memory); LEAVE(BadAlloc); } - surface->offsets = xalloc(sizeof(int)); + surface->offsets = malloc(sizeof(int)); if (surface->offsets == NULL) { - xfree(surface->pitches); + free(surface->pitches); SMI_FreeMemory(pScrn, surface_memory); LEAVE(BadAlloc); } - ptrOffscreen = xalloc(sizeof(SMI_OffscreenRec)); + ptrOffscreen = malloc(sizeof(SMI_OffscreenRec)); if (ptrOffscreen == NULL) { - xfree(surface->offsets); - xfree(surface->pitches); + free(surface->offsets); + free(surface->pitches); SMI_FreeMemory(pScrn, surface_memory); LEAVE(BadAlloc); } @@ -2426,9 +2424,9 @@ SMI_FreeSurface( } SMI_FreeMemory(pScrn, ptrOffscreen->surface_memory); - xfree(surface->pitches); - xfree(surface->offsets); - xfree(surface->devPrivate.ptr); + free(surface->pitches); + free(surface->offsets); + free(surface->devPrivate.ptr); LEAVE(Success); } |