Remove superfluous if(p!=NULL) checks around free(p); p=NULL;
This patch has been generated by the following Coccinelle semantic patch: @@ expression E; @@ - if (E != NULL) { - free(E); ( - E = NULL; | - E = 0; ) - } + free(E); + E = NULL; Signed-off-by: Cyril Brulebois <kibi@debian.org> Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
9e999d18b0
commit
99275ad2fa
|
@ -952,11 +952,9 @@ SetAccelerationProfile(
|
||||||
if(profile == NULL && profile_num != PROFILE_UNINITIALIZE)
|
if(profile == NULL && profile_num != PROFILE_UNINITIALIZE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if(vel->profile_private != NULL){
|
|
||||||
/* Here one could free old profile-private data */
|
/* Here one could free old profile-private data */
|
||||||
free(vel->profile_private);
|
free(vel->profile_private);
|
||||||
vel->profile_private = NULL;
|
vel->profile_private = NULL;
|
||||||
}
|
|
||||||
/* Here one could init profile-private data */
|
/* Here one could init profile-private data */
|
||||||
vel->Profile = profile;
|
vel->Profile = profile;
|
||||||
vel->statistics.profile_number = profile_num;
|
vel->statistics.profile_number = profile_num;
|
||||||
|
|
|
@ -215,11 +215,8 @@ fakeUnmapFramebuffer (KdScreenInfo *screen)
|
||||||
{
|
{
|
||||||
FakePriv *priv = screen->card->driver;
|
FakePriv *priv = screen->card->driver;
|
||||||
KdShadowFbFree (screen);
|
KdShadowFbFree (screen);
|
||||||
if (priv->base)
|
|
||||||
{
|
|
||||||
free(priv->base);
|
free(priv->base);
|
||||||
priv->base = 0;
|
priv->base = NULL;
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -516,11 +516,8 @@ winGetPaletteDD (ScreenPtr pScreen, ColormapPtr pcmap)
|
||||||
pScreen->blackPixel = 0;
|
pScreen->blackPixel = 0;
|
||||||
|
|
||||||
/* Free colormap */
|
/* Free colormap */
|
||||||
if (ppeColors != NULL)
|
|
||||||
{
|
|
||||||
free(ppeColors);
|
free(ppeColors);
|
||||||
ppeColors = NULL;
|
ppeColors = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
/* Free the DC */
|
/* Free the DC */
|
||||||
if (hdc != NULL)
|
if (hdc != NULL)
|
||||||
|
|
|
@ -163,11 +163,8 @@ winDestroyPixmapNativeGDI (PixmapPtr pPixmap)
|
||||||
if (pPixmapPriv->hBitmap) DeleteObject (pPixmapPriv->hBitmap);
|
if (pPixmapPriv->hBitmap) DeleteObject (pPixmapPriv->hBitmap);
|
||||||
|
|
||||||
/* Free the bitmap info header memory */
|
/* Free the bitmap info header memory */
|
||||||
if (pPixmapPriv->pbmih != NULL)
|
|
||||||
{
|
|
||||||
free(pPixmapPriv->pbmih);
|
free(pPixmapPriv->pbmih);
|
||||||
pPixmapPriv->pbmih = NULL;
|
pPixmapPriv->pbmih = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
/* Free the pixmap memory */
|
/* Free the pixmap memory */
|
||||||
free (pPixmap);
|
free (pPixmap);
|
||||||
|
|
|
@ -1140,10 +1140,8 @@ FinishFrameResize(WindowPtr pWin, Bool gravity, int oldX, int oldY,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gResizeDeathBits != NULL) {
|
|
||||||
free(gResizeDeathBits);
|
free(gResizeDeathBits);
|
||||||
gResizeDeathBits = NULL;
|
gResizeDeathBits = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
if (gravity) {
|
if (gravity) {
|
||||||
pScreen->CopyWindow = gResizeOldCopyWindowProc;
|
pScreen->CopyWindow = gResizeOldCopyWindowProc;
|
||||||
|
|
|
@ -321,17 +321,11 @@ miInitIndexed (ScreenPtr pScreen,
|
||||||
void
|
void
|
||||||
miCloseIndexed (ScreenPtr pScreen,
|
miCloseIndexed (ScreenPtr pScreen,
|
||||||
PictFormatPtr pFormat)
|
PictFormatPtr pFormat)
|
||||||
{
|
|
||||||
if (pFormat->index.devPrivate)
|
|
||||||
{
|
{
|
||||||
free(pFormat->index.devPrivate);
|
free(pFormat->index.devPrivate);
|
||||||
pFormat->index.devPrivate = 0;
|
pFormat->index.devPrivate = NULL;
|
||||||
}
|
|
||||||
if (pFormat->index.pValues)
|
|
||||||
{
|
|
||||||
free(pFormat->index.pValues);
|
free(pFormat->index.pValues);
|
||||||
pFormat->index.pValues = 0;
|
pFormat->index.pValues = NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1390,12 +1390,9 @@ SetPictureTransform (PicturePtr pPicture,
|
||||||
*pPicture->transform = *transform;
|
*pPicture->transform = *transform;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
if (pPicture->transform)
|
|
||||||
{
|
{
|
||||||
free(pPicture->transform);
|
free(pPicture->transform);
|
||||||
pPicture->transform = 0;
|
pPicture->transform = NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
|
pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
|
||||||
|
|
||||||
|
|
|
@ -212,13 +212,11 @@ XkbNamesPtr names;
|
||||||
register XkbKeyTypePtr type;
|
register XkbKeyTypePtr type;
|
||||||
type= map->types;
|
type= map->types;
|
||||||
for (i=0;i<map->num_types;i++,type++) {
|
for (i=0;i<map->num_types;i++,type++) {
|
||||||
if (type->level_names!=NULL) {
|
|
||||||
free(type->level_names);
|
free(type->level_names);
|
||||||
type->level_names = NULL;
|
type->level_names = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if ((which&XkbKeyNamesMask)&&(names->keys!=NULL)) {
|
if ((which&XkbKeyNamesMask)&&(names->keys!=NULL)) {
|
||||||
free(names->keys);
|
free(names->keys);
|
||||||
names->keys= NULL;
|
names->keys= NULL;
|
||||||
|
|
|
@ -50,10 +50,8 @@ _XkbFreeGeomLeafElems( Bool freeAll,
|
||||||
{
|
{
|
||||||
if ((freeAll)||(*elems==NULL)) {
|
if ((freeAll)||(*elems==NULL)) {
|
||||||
*num_inout= *sz_inout= 0;
|
*num_inout= *sz_inout= 0;
|
||||||
if (*elems!=NULL) {
|
|
||||||
free(*elems);
|
free(*elems);
|
||||||
*elems = NULL;
|
*elems = NULL;
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,23 +371,17 @@ XkbDoodadPtr doodad= (XkbDoodadPtr)doodad_in;
|
||||||
switch (doodad->any.type) {
|
switch (doodad->any.type) {
|
||||||
case XkbTextDoodad:
|
case XkbTextDoodad:
|
||||||
{
|
{
|
||||||
if (doodad->text.text!=NULL) {
|
|
||||||
free(doodad->text.text);
|
free(doodad->text.text);
|
||||||
doodad->text.text = NULL;
|
doodad->text.text = NULL;
|
||||||
}
|
|
||||||
if (doodad->text.font!=NULL) {
|
|
||||||
free(doodad->text.font);
|
free(doodad->text.font);
|
||||||
doodad->text.font = NULL;
|
doodad->text.font = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case XkbLogoDoodad:
|
case XkbLogoDoodad:
|
||||||
{
|
{
|
||||||
if (doodad->logo.logo_name!=NULL) {
|
|
||||||
free(doodad->logo.logo_name);
|
free(doodad->logo.logo_name);
|
||||||
doodad->logo.logo_name = NULL;
|
doodad->logo.logo_name = NULL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -434,10 +426,8 @@ XkbFreeGeometry(XkbGeometryPtr geom,unsigned which,Bool freeMap)
|
||||||
if ((which&XkbGeomKeyAliasesMask)&&(geom->key_aliases!=NULL))
|
if ((which&XkbGeomKeyAliasesMask)&&(geom->key_aliases!=NULL))
|
||||||
XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,TRUE);
|
XkbFreeGeomKeyAliases(geom,0,geom->num_key_aliases,TRUE);
|
||||||
if (freeMap) {
|
if (freeMap) {
|
||||||
if (geom->label_font!=NULL) {
|
|
||||||
free(geom->label_font);
|
free(geom->label_font);
|
||||||
geom->label_font = NULL;
|
geom->label_font = NULL;
|
||||||
}
|
|
||||||
free(geom);
|
free(geom);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -321,7 +321,7 @@ KeyCode matchingKeys[XkbMaxKeyCount],nMatchingKeys;
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (type->preserve!=NULL) {
|
else {
|
||||||
free(type->preserve);
|
free(type->preserve);
|
||||||
type->preserve = NULL;
|
type->preserve = NULL;
|
||||||
}
|
}
|
||||||
|
@ -807,31 +807,23 @@ XkbClientMapPtr map;
|
||||||
register int i;
|
register int i;
|
||||||
XkbKeyTypePtr type;
|
XkbKeyTypePtr type;
|
||||||
for (i=0,type=map->types;i<map->num_types;i++,type++) {
|
for (i=0,type=map->types;i<map->num_types;i++,type++) {
|
||||||
if (type->map!=NULL) {
|
|
||||||
free(type->map);
|
free(type->map);
|
||||||
type->map = NULL;
|
type->map = NULL;
|
||||||
}
|
|
||||||
if (type->preserve!=NULL) {
|
|
||||||
free(type->preserve);
|
free(type->preserve);
|
||||||
type->preserve = NULL;
|
type->preserve = NULL;
|
||||||
}
|
|
||||||
type->map_count= 0;
|
type->map_count= 0;
|
||||||
if (type->level_names!=NULL) {
|
|
||||||
free(type->level_names);
|
free(type->level_names);
|
||||||
type->level_names = NULL;
|
type->level_names = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
free(map->types);
|
free(map->types);
|
||||||
map->num_types= map->size_types= 0;
|
map->num_types= map->size_types= 0;
|
||||||
map->types= NULL;
|
map->types= NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (what&XkbKeySymsMask) {
|
if (what&XkbKeySymsMask) {
|
||||||
if (map->key_sym_map!=NULL) {
|
|
||||||
free(map->key_sym_map);
|
free(map->key_sym_map);
|
||||||
map->key_sym_map = NULL;
|
map->key_sym_map = NULL;
|
||||||
}
|
|
||||||
if (map->syms!=NULL) {
|
if (map->syms!=NULL) {
|
||||||
free(map->syms);
|
free(map->syms);
|
||||||
map->size_syms= map->num_syms= 0;
|
map->size_syms= map->num_syms= 0;
|
||||||
|
@ -864,10 +856,8 @@ XkbServerMapPtr map;
|
||||||
map->explicit= NULL;
|
map->explicit= NULL;
|
||||||
}
|
}
|
||||||
if (what&XkbKeyActionsMask) {
|
if (what&XkbKeyActionsMask) {
|
||||||
if (map->key_acts!=NULL) {
|
|
||||||
free(map->key_acts);
|
free(map->key_acts);
|
||||||
map->key_acts = NULL;
|
map->key_acts = NULL;
|
||||||
}
|
|
||||||
if (map->acts!=NULL) {
|
if (map->acts!=NULL) {
|
||||||
free(map->acts);
|
free(map->acts);
|
||||||
map->num_acts= map->size_acts= 0;
|
map->num_acts= map->size_acts= 0;
|
||||||
|
|
Loading…
Reference in New Issue