Harold, I am facing an issue of Memory access error in XWin -multiwindow mode see http://www.cygwin.com/ml/cygwin-xfree/2003-06/msg00294.html
So Ralf pointed me to http://cygwin.com/ml/cygwin-xfree/2003-06/msg00162.html After seeing that patch, I have just gone thru XWin Source and found, at lot of place we call memory alloc and not testing the return value. I am attaching the list & extracts from programs I dont know all of those will make any issue. I did not checked whether it is properly "free()"-ed And also I did not checked the functions which receives allocated memory another function as return value or thru a passed argument to the called function. List of variables:- in winmultiwindowwm.c pXMsgArg at function winInitWM in winmultiwindowwindow.c vlist at function winMoveXWindow vlist at function winResizeXWindow in winmultiwindowicons.c iconData at function winScaleXBitmapToWindows image at function winXIconToHICON imageMask at function winXIconToHICON mask at function winXIconToHICON in winmultiwindowclass.c *res_name at function winMultiWindowGetClassHint *res_role at function winMultiWindowGetWindowRole in winconfig.c ret at function winNormalizeName in winclipboardxevents.c pszUTF8 at function winClipboardFlushXEvents pszReturnData at function winClipboardFlushXEvents pwszUnicodeStr at function winClipboardFlushXEvents hGlobal at function winClipboardFlushXEvents in winclipboardtextconv.c pszDestBegin / pszDest at function winClipboardUNIXtoDOS ####### EXTRACTS FROM PROGRAMS ########## ####### NEXT FILE ########## winmultiwindowwm.c Bool winInitWM (void **ppWMInfo, pthread_t *ptWMProc, pthread_t *ptXMsgProc, pthread_mutex_t *ppmServerStarted, int dwScreen) { WMProcArgPtr pArg = (WMProcArgPtr) malloc (sizeof(WMProcArgRec)); WMInfoPtr pWMInfo = (WMInfoPtr) malloc (sizeof(WMInfoRec)); XMsgProcArgPtr pXMsgArg = (XMsgProcArgPtr) malloc (sizeof(XMsgProcArgRec)); /* Bail if the input parameters are bad */ if (pArg == NULL || pWMInfo == NULL) { ErrorF ("winInitWM - malloc fail.\n"); return FALSE; } ####### NEXT FILE ########## winmultiwindowwindow.c void winMoveXWindow (WindowPtr pWin, int x, int y) { XID *vlist = malloc(sizeof(long)*2); (CARD32*)vlist[0] = x; (CARD32*)vlist[1] = y; ConfigureWindow (pWin, CWX | CWY, vlist, wClient(pWin)); free(vlist); } /* * winResizeXWindow - */ void winResizeXWindow (WindowPtr pWin, int w, int h) { XID *vlist = malloc(sizeof(long)*2); (CARD32*)vlist[0] = w; (CARD32*)vlist[1] = h; ConfigureWindow (pWin, CWWidth | CWHeight, vlist, wClient(pWin)); free(vlist); } ####### NEXT FILE ########## winmultiwindowicons.c static void winScaleXBitmapToWindows (int iconSize, int effBPP, PixmapPtr pixmap, unsigned char *image) { ........ iconData = malloc (xStride * pixmap->drawable.height); miGetImage ((DrawablePtr) &(pixmap->drawable), 0, 0, pixmap->drawable.width, pixmap->drawable.height, ZPixmap, 0xffffffff, iconData); HICON winXIconToHICON (WindowPtr pWin) { ......... image = (unsigned char * ) malloc (stride * iconSize); imageMask = (unsigned char *) malloc (stride * iconSize); mask = (unsigned char *) malloc (maskStride * iconSize); ####### NEXT FILE ########## winmultiwindowclass.c int winMultiWindowGetClassHint (WindowPtr pWin, char **res_name, char **res_class) { .... (*res_name) = malloc (len_name + 1); int winMultiWindowGetWindowRole (WindowPtr pWin, char **res_role) { .... (*res_role) = malloc (len_role + 1); ####### NEXT FILE ########## winconfig.c char * winNormalizeName (const char *s) { ...... ret = malloc (strlen (s) + 1); ####### NEXT FILE ########## winclipboardxevents.c Bool winClipboardFlushXEvents (HWND hwnd, Atom atomClipboard, Atom atomLocalProperty, Atom atomUTF8String, Atom atomCompoundText, Atom atomTargets, Atom atomDeleteWindow, int iWindow, Display *pDisplay, Bool fUnicodeSupport) { ........ pszUTF8 = (char *) malloc (iUTF8); /* Don't need +1 */ WideCharToMultiByte (CP_UTF8, ........... if (iCount > 0) { pszReturnData = malloc (strlen (ppszTextList[0]) + 1); strcpy (pszReturnData, ppszTextList[0]); } else { pszReturnData = malloc (1); pszReturnData[0] = 0; } ........... pwszUnicodeStr = (wchar_t*) malloc (sizeof (wchar_t) * (iUnicodeLen + 1)); /* Do the actual conversion */ MultiByteToWideChar (CP_UTF8, 0, pszReturnData, -1, pwszUnicodeStr, iUnicodeLen); ........ /* Allocate global memory for the X clipboard data */ if (fUnicodeSupport) hGlobal = GlobalAlloc (GMEM_MOVEABLE, sizeof (wchar_t) * (iUnicodeLen + 1)); else hGlobal = GlobalAlloc (GMEM_MOVEABLE, strlen (pszReturnData) + 1); /* Obtain a pointer to the global memory */ pszGlobalData = GlobalLock (hGlobal); if (pszGlobalData == NULL) { ........ ####### NEXT FILE ########## winclipboardtextconv.c void winClipboardUNIXtoDOS (unsigned char **ppszData, int iLength) { ....... /* Allocate a new string */ pszDestBegin = pszDest = malloc (iLength + iNewlineCount + 1); ________________________________________________________________________ Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://uk.messenger.yahoo.com/
