changeset 3415:48aa44151317

[project @ 2000-01-10 19:27:43 by jwe]
author jwe
date Mon, 10 Jan 2000 19:27:43 +0000
parents f6c1c9deb22a
children 493df428100e
files liboctave/ChangeLog liboctave/pathsearch.cc
diffstat 2 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,8 @@
+2000-01-10  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* pathsearch.cc (dir_path::all_directories): Avoid dereferencing
+	NULL directory list returned from kpse_element_dirs
+
 1999-12-08  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* dbleLU.cc (LU::LU): Call DGETRF directly instead of calling DGESV.
--- a/liboctave/pathsearch.cc
+++ b/liboctave/pathsearch.cc
@@ -75,19 +75,23 @@
 	{
 	  str_llist_type *elt_dirs = kpse_element_dirs (pv[i].c_str ());
 
-	  str_llist_elt_type *dir;
-	  for (dir = *elt_dirs; dir; dir = STR_LLIST_NEXT (*dir))
+	  if (elt_dirs)
 	    {
-	      char *elt_dir = STR_LLIST (*dir);
+	      str_llist_elt_type *dir;
 
-	      if (elt_dir)
+	      for (dir = *elt_dirs; dir; dir = STR_LLIST_NEXT (*dir))
 		{
-		  if (count == nmax)
-		    nmax *= 2;
+		  char *elt_dir = STR_LLIST (*dir);
 
-		  retval.resize (nmax);
+		  if (elt_dir)
+		    {
+		      if (count == nmax)
+			nmax *= 2;
 
-		  retval[count++] = elt_dir;
+		      retval.resize (nmax);
+
+		      retval[count++] = elt_dir;
+		    }
 		}
 	    }
 	}