Commit adb76d07 by Robert Dewar Committed by Arnaud Charlet

a-direct.ads, [...] (Start_Search): Free allocated search buffer if an exception is raised.

2005-03-29  Robert Dewar  <dewar@adacore.com>

	* a-direct.ads, a-direct.adb (Start_Search): Free allocated search
	buffer if an exception is raised.

From-SVN: r97188
parent 077f6c59
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2004 Free Software Foundation, Inc. -- -- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -31,15 +31,15 @@ ...@@ -31,15 +31,15 @@
-- -- -- --
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
with Ada.Directories.Validity; use Ada.Directories.Validity; with Ada.Directories.Validity; use Ada.Directories.Validity;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Unchecked_Deallocation; with Ada.Unchecked_Deallocation;
with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Characters.Handling; use Ada.Characters.Handling;
with GNAT.Directory_Operations; use GNAT.Directory_Operations; with GNAT.Directory_Operations; use GNAT.Directory_Operations;
with GNAT.OS_Lib; use GNAT.OS_Lib; with GNAT.OS_Lib; use GNAT.OS_Lib;
with GNAT.Regexp; use GNAT.Regexp; with GNAT.Regexp; use GNAT.Regexp;
-- ??? Ada units cannot depend on GNAT units -- ??? Ada units should not depend on GNAT units
with System; with System;
...@@ -938,6 +938,7 @@ package body Ada.Directories is ...@@ -938,6 +938,7 @@ package body Ada.Directories is
exception exception
when Error_In_Regexp => when Error_In_Regexp =>
Free (Search.Value);
raise Name_Error; raise Name_Error;
end; end;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- S p e c -- -- S p e c --
-- -- -- --
-- Copyright (C) 2004 Free Software Foundation, Inc. -- -- Copyright (C) 2004-2005 Free Software Foundation, Inc. --
-- -- -- --
-- This specification is derived for use with GNAT from AI-00248, which is -- -- This specification is derived for use with GNAT from AI-00248, which is --
-- expected to be a part of a future expected revised Ada Reference Manual. -- -- expected to be a part of a future expected revised Ada Reference Manual. --
...@@ -304,10 +304,10 @@ package Ada.Directories is ...@@ -304,10 +304,10 @@ package Ada.Directories is
-- Starts a search in the directory entry in the directory named by -- Starts a search in the directory entry in the directory named by
-- Directory for entries matching Pattern. Pattern represents a file name -- Directory for entries matching Pattern. Pattern represents a file name
-- matching pattern. If Pattern is null, all items in the directory are -- matching pattern. If Pattern is null, all items in the directory are
-- matched; otherwise, the interpretation of Pattern is -- matched; otherwise, the interpretation of Pattern is implementation-
-- implementation-defined. Only items which match Filter will be returned. -- defined. Only items which match Filter will be returned. After a
-- After a successful call on Start_Search, the object Search may have -- successful call on Start_Search, the object Search may have entries
-- entries available, but it may have no entries available if no files or -- available, but it may have no entries available if no files or
-- directories match Pattern and Filter. The exception Name_Error is -- directories match Pattern and Filter. The exception Name_Error is
-- propagated if the string given by Directory does not identify an -- propagated if the string given by Directory does not identify an
-- existing directory, or if Pattern does not allow the identification of -- existing directory, or if Pattern does not allow the identification of
...@@ -317,7 +317,10 @@ package Ada.Directories is ...@@ -317,7 +317,10 @@ package Ada.Directories is
procedure End_Search (Search : in out Search_Type); procedure End_Search (Search : in out Search_Type);
-- Ends the search represented by Search. After a successful call on -- Ends the search represented by Search. After a successful call on
-- End_Search, the object Search will have no entries available. -- End_Search, the object Search will have no entries available. Note
-- that is is not necessary to call End_Search if the call to Start_Search
-- was unsuccessful and raised an exception (but it is harmless to make
-- the call in this case)>
function More_Entries (Search : Search_Type) return Boolean; function More_Entries (Search : Search_Type) return Boolean;
-- Returns True if more entries are available to be returned by a call -- Returns True if more entries are available to be returned by a call
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment