Skip to content

Commit aac0046

Browse files
committed
fix: memory leak in rezygisk_get_info
This commit fixes a memory leak in "rezygisk_get_info" as it would read a string from ReZygiskd but would never "free" after using it. Also call "free_rezygisk_info" instead of manually cleanup in ptracer.
1 parent 2f4f5af commit aac0046

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

loader/src/common/daemon.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ void rezygiskd_get_info(struct rezygisk_info *info) {
149149
char module_path[PATH_MAX];
150150
snprintf(module_path, sizeof(module_path), "/data/adb/modules/%s/module.prop", module_name);
151151

152+
free(module_name);
153+
152154
FILE *module_prop = fopen(module_path, "r");
153155
if (!module_prop) {
154156
PLOGE("failed to open module prop file %s", module_path);

loader/src/ptracer/main.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,13 @@ int main(int argc, char **argv) {
8282

8383
for (size_t i = 0; i < info.modules->modules_count; i++) {
8484
printf(" - %s\n", info.modules->modules[i]);
85-
86-
free(info.modules->modules[i]);
8785
}
88-
89-
free(info.modules->modules);
9086
} else {
9187
printf("Modules: N/A\n");
9288
}
9389

90+
free_rezygisk_info(&info);
91+
9492
return 0;
9593
} else {
9694
printf(

0 commit comments

Comments
 (0)