Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
1ce25987
Commit
1ce25987
authored
Jan 26, 2012
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug that causes segmentation fault when erasing key which does not exist in map.
parent
43c0ef81
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
7 deletions
+11
-7
lib/spdylay_map.c
lib/spdylay_map.c
+8
-6
tests/spdylay_map_test.c
tests/spdylay_map_test.c
+3
-1
No files found.
lib/spdylay_map.c
View file @
1ce25987
...
@@ -164,12 +164,14 @@ static spdylay_map_entry* erase_rotate_recur(spdylay_map_entry *entry)
...
@@ -164,12 +164,14 @@ static spdylay_map_entry* erase_rotate_recur(spdylay_map_entry *entry)
static
spdylay_map_entry
*
erase_recur
(
spdylay_map_entry
*
entry
,
key_type
key
)
static
spdylay_map_entry
*
erase_recur
(
spdylay_map_entry
*
entry
,
key_type
key
)
{
{
if
(
key
<
entry
->
key
)
{
if
(
entry
!=
NULL
)
{
entry
->
left
=
erase_recur
(
entry
->
left
,
key
);
if
(
key
<
entry
->
key
)
{
}
else
if
(
key
>
entry
->
key
)
{
entry
->
left
=
erase_recur
(
entry
->
left
,
key
);
entry
->
right
=
erase_recur
(
entry
->
right
,
key
);
}
else
if
(
key
>
entry
->
key
)
{
}
else
{
entry
->
right
=
erase_recur
(
entry
->
right
,
key
);
entry
=
erase_rotate_recur
(
entry
);
}
else
{
entry
=
erase_rotate_recur
(
entry
);
}
}
}
return
entry
;
return
entry
;
}
}
...
...
tests/spdylay_map_test.c
View file @
1ce25987
...
@@ -47,9 +47,11 @@ void test_spdylay_map()
...
@@ -47,9 +47,11 @@ void test_spdylay_map()
spdylay_map_erase
(
&
map
,
1
);
spdylay_map_erase
(
&
map
,
1
);
CU_ASSERT
(
NULL
==
spdylay_map_find
(
&
map
,
1
));
CU_ASSERT
(
NULL
==
spdylay_map_find
(
&
map
,
1
));
spdylay_map_erase
(
&
map
,
1
);
CU_ASSERT
(
NULL
==
spdylay_map_find
(
&
map
,
1
));
CU_ASSERT
(
strcmp
(
"bar"
,
spdylay_map_find
(
&
map
,
2
))
==
0
);
CU_ASSERT
(
strcmp
(
"bar"
,
spdylay_map_find
(
&
map
,
2
))
==
0
);
CU_ASSERT
(
strcmp
(
"shrubbery"
,
spdylay_map_find
(
&
map
,
4
))
==
0
);
CU_ASSERT
(
strcmp
(
"shrubbery"
,
spdylay_map_find
(
&
map
,
4
))
==
0
);
spdylay_map_free
(
&
map
);
spdylay_map_free
(
&
map
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment