Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
bd7766b1
Commit
bd7766b1
authored
Feb 11, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prevent small memory leak
parent
70b7d734
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
4 deletions
+23
-4
misc.c
native/jni/utils/misc.c
+23
-4
No files found.
native/jni/utils/misc.c
View file @
bd7766b1
...
...
@@ -51,7 +51,7 @@ int check_data() {
struct
vector
v
;
vec_init
(
&
v
);
file_to_vector
(
"/proc/mounts"
,
&
v
);
char
*
line
,
*
crypto
;
char
*
line
;
int
mnt
=
0
;
vec_for_each
(
&
v
,
line
)
{
if
(
strstr
(
line
,
" /data "
))
{
...
...
@@ -61,9 +61,28 @@ int check_data() {
}
}
vec_deep_destroy
(
&
v
);
// /data is mounted and not tmpfs and data is unencrypted or vold is started
return
mnt
&&
(((
crypto
=
getprop
(
"ro.crypto.state"
))
&&
strcmp
(
crypto
,
"unencrypted"
)
==
0
)
||
getprop
(
"init.svc.vold"
));
int
data
=
0
;
if
(
mnt
)
{
char
*
crypto
=
getprop
(
"ro.crypto.state"
);
if
(
crypto
!=
NULL
)
{
if
(
strcmp
(
crypto
,
"unencrypted"
)
==
0
)
{
// Unencrypted, we can directly access data
data
=
1
;
}
else
{
// Encrypted, check whether vold is started
char
*
vold
=
getprop
(
"init.svc.vold"
);
if
(
vold
!=
NULL
)
{
free
(
vold
);
data
=
1
;
}
}
free
(
crypto
);
}
else
{
// ro.crypto.state is not set, assume it's unencrypted
data
=
1
;
}
}
return
data
;
}
/* All the string should be freed manually!! */
...
...
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