Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
1a6bc7c5
Commit
1a6bc7c5
authored
9 years ago
by
Deomid Ryabkov
Committed by
Marko Mikulicic
9 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix mbuf_resize(0)
PUBLISHED_FROM=7cab7543db990f7f67b53edca4f65ba45b219711
parent
ffa0ddfd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
mongoose.c
mongoose.c
+8
-5
No files found.
mongoose.c
View file @
1a6bc7c5
...
...
@@ -143,11 +143,14 @@ void mbuf_free(struct mbuf *mbuf) {
}
void
mbuf_resize
(
struct
mbuf
*
a
,
size_t
new_size
)
{
char
*
p
;
if
((
new_size
>
a
->
size
||
(
new_size
<
a
->
size
&&
new_size
>=
a
->
len
))
&&
(
p
=
(
char
*
)
MBUF_REALLOC
(
a
->
buf
,
new_size
))
!=
NULL
)
{
a
->
size
=
new_size
;
a
->
buf
=
p
;
if
(
new_size
>
a
->
size
||
(
new_size
<
a
->
size
&&
new_size
>=
a
->
len
))
{
a
->
buf
=
(
char
*
)
MBUF_REALLOC
(
a
->
buf
,
new_size
);
/*
* In case realloc fails, there's not much we can do except set size to 0.
* Note that NULL is a valid return value from realloc when size == 0, but
* that is covered too.
*/
a
->
size
=
(
a
->
buf
!=
NULL
?
new_size
:
0
);
}
}
...
...
This diff is collapsed.
Click to expand it.
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