summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-06-21 14:23:38 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-06-21 14:23:38 +0000
commita1b650ad7be4f8ec2fb486244f2f303434d43dfc (patch)
tree9a9b01cca304646e7af6e23a0222671fe0922d0e
parentd978f85d553686714ce408e90280cbcce692f5d4 (diff)
downloadgnurl-a1b650ad7be4f8ec2fb486244f2f303434d43dfc.tar.gz
gnurl-a1b650ad7be4f8ec2fb486244f2f303434d43dfc.tar.bz2
gnurl-a1b650ad7be4f8ec2fb486244f2f303434d43dfc.zip
Gerrit Bruchhäuser pointed out a warning that the Intel(R) Thread Checker
tool reports and it was indeed a legitimate one and it is one fixed. It was a use of a share without doing the proper locking first.
-rw-r--r--CHANGES5
-rw-r--r--RELEASE-NOTES4
-rw-r--r--lib/url.c5
-rw-r--r--tests/data/test50668
4 files changed, 49 insertions, 33 deletions
diff --git a/CHANGES b/CHANGES
index 18bdd0102..38a734f02 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,11 @@
Changelog
+Daniel S (21 June 2007)
+- Gerrit Bruchhäuser pointed out a warning that the Intel(R) Thread Checker
+ tool reports and it was indeed a legitimate one and it is one fixed. It was
+ a use of a share without doing the proper locking first.
+
Daniel S (20 June 2007)
- Adam Piggott filed bug report #1740263
(http://curl.haxx.se/bug/view.cgi?id=1740263). Adam discovered that when
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 21fa2b506..dc4b1f523 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -60,6 +60,7 @@ This release includes the following bugfixes:
o multi interface HTTP CONNECT glitch
o list FTP root directories when login dir is not root
o no longer slows down when getting very many URLs on the same command line
+ o lock share before decreasing dirty counter
This release includes the following known bugs:
@@ -86,6 +87,7 @@ advice from friends like these:
Frank Hempel, Michael Wallner, Jeff Pohlmeyer, Tobias Rundström,
Anders Gustafsson, James Bursa, Kristian Gunstone, Feng Tu,
Andre Guibert de Bruet, Rob Crittenden, Rich Rauenzahn, Tom Regner,
- Dave Vasilevsky, Shmulik Regev, Robson Braga Araujo, Adam Piggott
+ Dave Vasilevsky, Shmulik Regev, Robson Braga Araujo, Adam Piggott,
+ Gerrit Bruchhäuser
Thanks! (and sorry if I forgot to mention someone)
diff --git a/lib/url.c b/lib/url.c
index 8165c9298..789959762 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -378,8 +378,11 @@ CURLcode Curl_close(struct SessionHandle *data)
#endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */
/* No longer a dirty share, if it exists */
- if (data->share)
+ if (data->share) {
+ Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);
data->share->dirty--;
+ Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
+ }
free(data);
return CURLE_OK;
diff --git a/tests/data/test506 b/tests/data/test506
index 1d658f3fa..65a2758d5 100644
--- a/tests/data/test506
+++ b/tests/data/test506
@@ -90,60 +90,66 @@ lock: dns <Pigs in space>: 16
unlock: dns <Pigs in space>: 17
lock: cookie <Pigs in space>: 18
unlock: cookie <Pigs in space>: 19
-*** run 2
-CURLOPT_SHARE
lock: share <Pigs in space>: 20
unlock: share <Pigs in space>: 21
+*** run 2
+CURLOPT_SHARE
+lock: share <Pigs in space>: 22
+unlock: share <Pigs in space>: 23
PERFORM
-lock: dns <Pigs in space>: 22
-unlock: dns <Pigs in space>: 23
lock: dns <Pigs in space>: 24
unlock: dns <Pigs in space>: 25
-lock: cookie <Pigs in space>: 26
-unlock: cookie <Pigs in space>: 27
+lock: dns <Pigs in space>: 26
+unlock: dns <Pigs in space>: 27
lock: cookie <Pigs in space>: 28
unlock: cookie <Pigs in space>: 29
lock: cookie <Pigs in space>: 30
unlock: cookie <Pigs in space>: 31
+lock: cookie <Pigs in space>: 32
+unlock: cookie <Pigs in space>: 33
run 2: set cookie 4 and 5
-lock: dns <Pigs in space>: 32
-unlock: dns <Pigs in space>: 33
-CLEANUP
lock: dns <Pigs in space>: 34
unlock: dns <Pigs in space>: 35
-lock: cookie <Pigs in space>: 36
-unlock: cookie <Pigs in space>: 37
+CLEANUP
+lock: dns <Pigs in space>: 36
+unlock: dns <Pigs in space>: 37
+lock: cookie <Pigs in space>: 38
+unlock: cookie <Pigs in space>: 39
+lock: share <Pigs in space>: 40
+unlock: share <Pigs in space>: 41
*** run 3
CURLOPT_SHARE
-lock: share <Pigs in space>: 38
-unlock: share <Pigs in space>: 39
+lock: share <Pigs in space>: 42
+unlock: share <Pigs in space>: 43
CURLOPT_COOKIEJAR
PERFORM
-lock: dns <Pigs in space>: 40
-unlock: dns <Pigs in space>: 41
-lock: dns <Pigs in space>: 42
-unlock: dns <Pigs in space>: 43
-lock: cookie <Pigs in space>: 44
-unlock: cookie <Pigs in space>: 45
-lock: cookie <Pigs in space>: 46
-unlock: cookie <Pigs in space>: 47
+lock: dns <Pigs in space>: 44
+unlock: dns <Pigs in space>: 45
+lock: dns <Pigs in space>: 46
+unlock: dns <Pigs in space>: 47
lock: cookie <Pigs in space>: 48
unlock: cookie <Pigs in space>: 49
+lock: cookie <Pigs in space>: 50
+unlock: cookie <Pigs in space>: 51
+lock: cookie <Pigs in space>: 52
+unlock: cookie <Pigs in space>: 53
run 3: overwrite cookie 1 and 4
-lock: dns <Pigs in space>: 50
-unlock: dns <Pigs in space>: 51
+lock: dns <Pigs in space>: 54
+unlock: dns <Pigs in space>: 55
try SHARE_CLEANUP...
-lock: share <Pigs in space>: 52
-unlock: share <Pigs in space>: 53
+lock: share <Pigs in space>: 56
+unlock: share <Pigs in space>: 57
SHARE_CLEANUP failed, correct
CLEANUP
-lock: dns <Pigs in space>: 54
-unlock: dns <Pigs in space>: 55
-lock: cookie <Pigs in space>: 56
-unlock: cookie <Pigs in space>: 57
+lock: dns <Pigs in space>: 58
+unlock: dns <Pigs in space>: 59
+lock: cookie <Pigs in space>: 60
+unlock: cookie <Pigs in space>: 61
+lock: share <Pigs in space>: 62
+unlock: share <Pigs in space>: 63
SHARE_CLEANUP
-lock: share <Pigs in space>: 58
-unlock: share <Pigs in space>: 59
+lock: share <Pigs in space>: 64
+unlock: share <Pigs in space>: 65
GLOBAL_CLEANUP
</stdout>
<stderr>