[PATCH:libX11 00/22] libX11 cleanup series, v2

Alan Coopersmith alan.coopersmith at oracle.com
Mon Aug 12 00:03:51 PDT 2013


As always with Xlib, when looking at the code to fix one thing, you end
up finding a dozen more things that could be better.   This splits and
rearranges some of the v1 patches as discussed from Matthieu's reviews, 
and adds a few more fixes to the end, because I ended up looking at more
Xlib code to resolve these, and some things are hard to unsee.

Perhaps one of these days I'll learn my lesson and ignore the warnings
from the compilers & static analyzers that end up sending me down these
ratholes, but I may just be a little too OCD-like to quit cold turkey.

Alan Coopersmith (22):
  Fix file leak on malloc error in XlcDL.c:resolve_object()
  lcfile: skip over any null entries in args list
  xlibi18n: convert sprintf calls to snprintf
  ximcp/imRm.c: convert sprintf calls to snprintf
  omGeneric.c: convert sprintf calls to snprintf
  Avoid memory leak/corruption if realloc fails in XlcDL.c:resolve_object()
  lcDB.c: ensure buffer size is updated correctly if realloc fails
  Avoid memory leak/corruption if realloc fails in imLcPrs.c:parseline()
  Avoid memory leak/corruption if realloc fails in Xregion.h:MEMCHECK macro
  miRegionCopy(): handle realloc failure better
  miRegionOp(): ensure region size is not updated if realloc fails
  Delete unused XKB_INSURE_SIZE macro from XKBlibint.h
  init_om: remove unneeded extra copy of string to local buffer
  Constify lc_name argument to _XlcLocaleDirName() & _XlcLocaleLibDirName()
  Fix const handling in XSetLocaleModifiers
  xlibi18n: Fix a bunch of const cast warnings
  i18n modules: Fix some const cast warnings
  xlibi18n: fix argsize argument to _XlcParsePath
  Remove even more casts of return values from Xmalloc/Xrealloc
  Don't cast sizeof() results to unsigned when passing to Xmalloc/Xcalloc
  Remove unnecessary casts of pointers to (char *) in calls to Xfree()
  Remove long unused src/udcInf.c

 configure.ac                           |    2 -
 include/X11/Xregion.h                  |    7 +-
 modules/im/ximcp/imCallbk.c            |   17 +-
 modules/im/ximcp/imDefIc.c             |   52 +--
 modules/im/ximcp/imDefIm.c             |   40 +-
 modules/im/ximcp/imDefLkup.c           |   16 +-
 modules/im/ximcp/imDispch.c            |    2 +-
 modules/im/ximcp/imExten.c             |    6 +-
 modules/im/ximcp/imInsClbk.c           |    2 +-
 modules/im/ximcp/imInt.c               |    4 +-
 modules/im/ximcp/imLcIc.c              |    2 +-
 modules/im/ximcp/imLcIm.c              |    2 +-
 modules/im/ximcp/imLcPrs.c             |   35 +-
 modules/im/ximcp/imRm.c                |   60 ++-
 modules/im/ximcp/imRmAttr.c            |   12 +-
 modules/im/ximcp/imThaiIc.c            |   10 +-
 modules/im/ximcp/imThaiIm.c            |    2 +-
 modules/im/ximcp/imTrX.c               |    2 +-
 modules/im/ximcp/imTrans.c             |    2 +-
 modules/im/ximcp/imTransR.c            |    8 +-
 modules/lc/def/lcDefConv.c             |    8 +-
 modules/lc/gen/lcGenConv.c             |   28 +-
 modules/lc/xlocale/lcEuc.c             |    4 +-
 modules/lc/xlocale/lcJis.c             |    8 +-
 modules/lc/xlocale/lcSjis.c            |    4 +-
 modules/om/generic/omGeneric.c         |   57 +--
 src/Context.c                          |   12 +-
 src/FetchName.c                        |    4 +-
 src/Font.c                             |   66 +--
 src/FontInfo.c                         |   18 +-
 src/FontNames.c                        |    4 +-
 src/FreeEData.c                        |    4 +-
 src/FreeGC.c                           |    2 +-
 src/GetFPath.c                         |    4 +-
 src/GetHints.c                         |   24 +-
 src/GetNrmHint.c                       |    4 +-
 src/GetRGBCMap.c                       |   10 +-
 src/GetStCmap.c                        |    6 +-
 src/GetWMCMapW.c                       |    2 +-
 src/GetWMProto.c                       |    2 +-
 src/ImUtil.c                           |    8 +-
 src/InitExt.c                          |    2 +-
 src/IntAtom.c                          |    6 +-
 src/KeyBind.c                          |   12 +-
 src/ListExt.c                          |    6 +-
 src/Makefile.am                        |    5 -
 src/ModMap.c                           |    8 +-
 src/OpenDis.c                          |   20 +-
 src/PolyReg.c                          |    6 +-
 src/PutImage.c                         |    6 +-
 src/QuColors.c                         |    2 +-
 src/Quarks.c                           |    2 +-
 src/RdBitF.c                           |    4 +-
 src/Region.c                           |   28 +-
 src/RegstFlt.c                         |    4 +-
 src/SetFPath.c                         |    2 +-
 src/SetHints.c                         |    2 +-
 src/SetRGBCMap.c                       |    2 +-
 src/StBytes.c                          |    2 +-
 src/TextToStr.c                        |    4 +-
 src/VisUtil.c                          |    4 +-
 src/Xrm.c                              |   28 +-
 src/locking.c                          |   12 +-
 src/udcInf.c                           |  715 --------------------------------
 src/xcms/CCC.c                         |    5 +-
 src/xcms/CvCols.c                      |    6 +-
 src/xcms/IdOfPr.c                      |    2 +-
 src/xcms/LRGB.c                        |   36 +-
 src/xcms/SetGetCols.c                  |   10 +-
 src/xcms/StCols.c                      |    4 +-
 src/xcms/cmsCmap.c                     |   11 +-
 src/xcms/cmsColNm.c                    |    8 +-
 src/xcms/cmsInt.c                      |   11 +-
 src/xkb/XKBlibint.h                    |    6 -
 src/xlibi18n/ICWrap.c                  |   14 +-
 src/xlibi18n/IMWrap.c                  |    2 +-
 src/xlibi18n/XDefaultIMIF.c            |   12 +-
 src/xlibi18n/XDefaultOMIF.c            |   33 +-
 src/xlibi18n/XlcDL.c                   |   29 +-
 src/xlibi18n/XlcPubI.h                 |    4 +-
 src/xlibi18n/lcCT.c                    |   18 +-
 src/xlibi18n/lcCharSet.c               |   10 +-
 src/xlibi18n/lcConv.c                  |   10 +-
 src/xlibi18n/lcDB.c                    |   29 +-
 src/xlibi18n/lcDynamic.c               |    4 +-
 src/xlibi18n/lcFile.c                  |  146 +++----
 src/xlibi18n/lcGeneric.c               |   89 ++--
 src/xlibi18n/lcPrTxt.c                 |   10 +-
 src/xlibi18n/lcPubWrap.c               |    2 +-
 src/xlibi18n/lcPublic.c                |    5 +-
 src/xlibi18n/lcRM.c                    |   10 +-
 src/xlibi18n/lcTxtPr.c                 |    4 +-
 src/xlibi18n/lcUTF8.c                  |   20 +-
 src/xlibi18n/lcUniConv/8bit_tab_to_h.c |    6 +-
 src/xlibi18n/lcUniConv/cjk_tab_to_h.c  |   14 +-
 src/xlibi18n/lcWrap.c                  |   16 +-
 src/xlibi18n/mbWMProps.c               |    4 +-
 src/xlibi18n/mbWrap.c                  |   12 +-
 src/xlibi18n/utf8WMProps.c             |    4 +-
 src/xlibi18n/utf8Wrap.c                |   12 +-
 100 files changed, 660 insertions(+), 1402 deletions(-)
 delete mode 100644 src/udcInf.c

-- 
1.7.9.2



More information about the xorg-devel mailing list