TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: BOB STOUT
from: GEORGE WHITE
date: 1998-03-29 11:27:00
subject: SNIPPETS filelist()

Hi Bob,
I've just been checking the SNIPPETS filelist.c code and found a problem
with the test harness :-(. I suspect an extranious "=" crept in behind
your back :-). If there are no matches in Get_FileList() or a malloc()
fails Get_FileList() returns 0 and leaves list pointer uninitialised or
set to NULL respectively. This causes a null pointer assignment error
under Borland C when Free_FileList() gets called incorrectly.
To show usage correctly change:
      nFiles = Get_FileList(plist, argv + 1, argc - 1, _A_FILE);
      if (nFiles >= 0)
      {
to
      nFiles = Get_FileList(plist, argv + 1, argc - 1, _A_FILE);
      if (nFiles > 0) /* Only if files found and no other error */
      {
Get_FileList() has no way of returning a negative number as coded, so
the error reporting "else" condition cannot be reached without the
change...
George
ps Did you get the email from me about atotm() ?
pps Was this a test "bug" in a "Find the Bug" competition :-)
 * SLMR 2.1a * Wastebasket: Something to throw things near.
--- Maximus/2 3.01
---------------
* Origin: DoNoR/2,Woking UK (44-1483-717905) (2:440/4)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.