changeset 12303:2c35dfd641ff release-3-4-x

lo-sysdep.cc (opendir): on error, free allocated DIR object befor returning
author Pascal Dupuis <Pascal.Dupuis@uclouvain.be>
date Sun, 30 Jan 2011 04:38:35 -0500
parents 1b71befc2f40
children c16ce72e0a22
files liboctave/ChangeLog liboctave/lo-sysdep.cc
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog
+++ b/liboctave/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-30  Pascal Dupuis  <Pascal.Dupuis@worldonline.be>
+
+	* lo-sysdep.cc (opendir): On error, free allocated DIR object
+	before returning.
+
 2011-01-28  John W. Eaton  <jwe@octave.org>
 
 	* eigs-base.cc: Remove #endif corresponding to "#ifdef HAVE_ARPACK",
--- a/liboctave/lo-sysdep.cc
+++ b/liboctave/lo-sysdep.cc
@@ -172,7 +172,10 @@
   d->current = buffer;
   d->hnd = FindFirstFile (buffer, &(d->fd));
   if (d->hnd == INVALID_HANDLE_VALUE)
-    return 0;
+    {
+      free (d);
+      return 0;
+    }
   d->dirty = 1;
   return d;
 }