Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
libplist
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwn
libplist
Commits
1b9bf8b0
Commit
1b9bf8b0
authored
4 years ago
by
Nikias Bassen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bplist: Remove unnecessary allocation and unused variables
parent
baf50929
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
10 deletions
+5
-10
bplist.c
src/bplist.c
+5
-10
No files found.
src/bplist.c
View file @
1b9bf8b0
...
...
@@ -1170,11 +1170,9 @@ PLIST_API void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
uint64_t
offset_table_index
=
0
;
bytearray_t
*
bplist_buff
=
NULL
;
uint64_t
i
=
0
;
uint8_t
*
buff
=
NULL
;
uint64_t
*
offsets
=
NULL
;
bplist_trailer_t
trailer
;
uint64_t
objects_len
=
0
;
uint64_t
buff_len
=
0
;
//check for valid input
if
(
!
plist
||
!
plist_bin
||
*
plist_bin
||
!
length
)
...
...
@@ -1298,13 +1296,11 @@ PLIST_API void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
switch
(
data
->
type
)
{
case
PLIST_BOOLEAN
:
buff
=
(
uint8_t
*
)
malloc
(
sizeof
(
uint8_t
));
buff
[
0
]
=
data
->
boolval
?
BPLIST_TRUE
:
BPLIST_FALSE
;
byte_array_append
(
bplist_buff
,
buff
,
sizeof
(
uint8_t
));
free
(
buff
);
case
PLIST_BOOLEAN
:
{
uint8_t
b
=
data
->
boolval
?
BPLIST_TRUE
:
BPLIST_FALSE
;
byte_array_append
(
bplist_buff
,
&
b
,
1
);
break
;
}
case
PLIST_UINT
:
if
(
data
->
length
==
16
)
{
write_uint
(
bplist_buff
,
data
->
intval
);
...
...
@@ -1353,8 +1349,7 @@ PLIST_API void plist_to_bin(plist_t plist, char **plist_bin, uint32_t * length)
hash_table_destroy
(
ref_table
);
//write offsets
buff_len
=
bplist_buff
->
len
;
offset_size
=
get_needed_bytes
(
buff_len
);
offset_size
=
get_needed_bytes
(
bplist_buff
->
len
);
offset_table_index
=
bplist_buff
->
len
;
for
(
i
=
0
;
i
<
num_objects
;
i
++
)
{
uint64_t
offset
=
be64toh
(
offsets
[
i
]);
...
...
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