diff options
author | Justin Clark-Casey (justincc) | 2013-02-27 00:21:02 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-27 00:21:02 +0000 |
commit | 80c19b7cac52a57fd04966169c657400aeee3de8 (patch) | |
tree | 32c48c0d00da28ed091d8c6a671d43d1e9ab8bdb /OpenSim/ConsoleClient/Requester.cs | |
parent | minor: Remove unnecessary very old System.Net reference in OpenSim.Region.Scr... (diff) | |
download | opensim-SC_OLD-80c19b7cac52a57fd04966169c657400aeee3de8.zip opensim-SC_OLD-80c19b7cac52a57fd04966169c657400aeee3de8.tar.gz opensim-SC_OLD-80c19b7cac52a57fd04966169c657400aeee3de8.tar.bz2 opensim-SC_OLD-80c19b7cac52a57fd04966169c657400aeee3de8.tar.xz |
Make sure we dispose of WebResponse, StreamReader and Stream in various places where we were not already.
Diffstat (limited to 'OpenSim/ConsoleClient/Requester.cs')
-rw-r--r-- | OpenSim/ConsoleClient/Requester.cs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/OpenSim/ConsoleClient/Requester.cs b/OpenSim/ConsoleClient/Requester.cs index aabb02c..0a21328 100644 --- a/OpenSim/ConsoleClient/Requester.cs +++ b/OpenSim/ConsoleClient/Requester.cs | |||
@@ -44,7 +44,6 @@ namespace OpenSim.ConsoleClient | |||
44 | ReplyDelegate action) | 44 | ReplyDelegate action) |
45 | { | 45 | { |
46 | WebRequest request = WebRequest.Create(requestUrl); | 46 | WebRequest request = WebRequest.Create(requestUrl); |
47 | WebResponse response = null; | ||
48 | 47 | ||
49 | request.Method = "POST"; | 48 | request.Method = "POST"; |
50 | 49 | ||
@@ -64,16 +63,18 @@ namespace OpenSim.ConsoleClient | |||
64 | { | 63 | { |
65 | string reply = String.Empty; | 64 | string reply = String.Empty; |
66 | 65 | ||
67 | response = request.EndGetResponse(ar); | 66 | using (WebResponse response = request.EndGetResponse(ar)) |
68 | |||
69 | try | ||
70 | { | 67 | { |
71 | StreamReader r = new StreamReader(response.GetResponseStream()); | 68 | try |
72 | reply = r.ReadToEnd(); | 69 | { |
70 | using (Stream s = response.GetResponseStream()) | ||
71 | using (StreamReader r = new StreamReader(s)) | ||
72 | reply = r.ReadToEnd(); | ||
73 | 73 | ||
74 | } | 74 | } |
75 | catch (System.InvalidOperationException) | 75 | catch (System.InvalidOperationException) |
76 | { | 76 | { |
77 | } | ||
77 | } | 78 | } |
78 | 79 | ||
79 | action(requestUrl, data, reply); | 80 | action(requestUrl, data, reply); |