Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!hellgate.utah.edu!dog.ee.lbl.gov!ucbvax!bloom-beacon!dont-send-mail-to-path-lines From: pete@iris49.UUCP (Pete Ware) Newsgroups: comp.windows.x Subject: XtAddInput returns; error checking in general Message-ID: <9102141628.AA03719@iris49.biosym.com> Date: 14 Feb 91 16:28:16 GMT References: <64840@brunix.UUCP> Sender: daemon@athena.mit.edu (Mr Background) Organization: The Internet Lines: 16 jim> But, I see a subsequent call to XtNew(), which calls malloc(). jim> XtAddInput() then uses the result without checking for a valid jim> pointer. It is this pointer that is returned as the XtInputId. jim> Putting aside the fact that the current implementation of jim> XtAddInput() will crash if the allocation fails, should I check jim> for a NULL return? or should this truly be considered opaque? XtMalloc() calls XtErrorMsg() if the allocation fails. For better or worse, XtErrorMsg() is for fatal errors and the application exits. In other words, XtMalloc() exits instead of returning NULL. --pete Pete Ware / Biosym / San Diego CA / (619) 546-5532 uucp: scripps.edu!bioc1!pete Internet: bioc1!pete@scripps.edu