Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iproute2
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
iproute2
Commits
532ca40a
Commit
532ca40a
authored
Aug 06, 2015
by
Phil Sutter
Committed by
Stephen Hemminger
Aug 12, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
misc/ss: simplify buffer realloc, fix checking realloc failure
Signed-off-by:
Phil Sutter
<
phil@nwl.cc
>
parent
e0dce0e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
misc/ss.c
misc/ss.c
+3
-3
No files found.
misc/ss.c
View file @
532ca40a
...
@@ -550,7 +550,7 @@ static int find_entry(unsigned ino, char **buf, int type)
...
@@ -550,7 +550,7 @@ static int find_entry(unsigned ino, char **buf, int type)
struct
user_ent
*
p
;
struct
user_ent
*
p
;
int
cnt
=
0
;
int
cnt
=
0
;
char
*
ptr
;
char
*
ptr
;
char
*
*
new_buf
=
buf
;
char
*
new_
buf
;
int
len
,
new_buf_len
;
int
len
,
new_buf_len
;
int
buf_used
=
0
;
int
buf_used
=
0
;
int
buf_len
=
0
;
int
buf_len
=
0
;
...
@@ -592,12 +592,12 @@ static int find_entry(unsigned ino, char **buf, int type)
...
@@ -592,12 +592,12 @@ static int find_entry(unsigned ino, char **buf, int type)
if
(
len
<
0
||
len
>=
buf_len
-
buf_used
)
{
if
(
len
<
0
||
len
>=
buf_len
-
buf_used
)
{
new_buf_len
=
buf_len
+
ENTRY_BUF_SIZE
;
new_buf_len
=
buf_len
+
ENTRY_BUF_SIZE
;
*
new_buf
=
realloc
(
*
buf
,
new_buf_len
);
new_buf
=
realloc
(
*
buf
,
new_buf_len
);
if
(
!
new_buf
)
{
if
(
!
new_buf
)
{
fprintf
(
stderr
,
"ss: failed to malloc buffer
\n
"
);
fprintf
(
stderr
,
"ss: failed to malloc buffer
\n
"
);
abort
();
abort
();
}
}
*
buf
=
*
new_buf
;
*
buf
=
new_buf
;
buf_len
=
new_buf_len
;
buf_len
=
new_buf_len
;
continue
;
continue
;
}
else
{
}
else
{
...
...
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