Skip to content

Commit

Permalink
fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
lvyitian committed Aug 20, 2023
1 parent 0f98c24 commit 592760a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ ext {
moduleName = "YuanShenRedirect"
moduleAuthor = "Perfare"
moduleDescription = "Redirect file access of YuanShen"
moduleVersion = "v1.1.0"
moduleVersion = "v1.2.0"
moduleVersionCode = 1
}
20 changes: 20 additions & 0 deletions module/src/main/cpp/open_hook.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,36 @@ char* str_replace(char* orig, char* rep, char* with) {
char* path_replace(const char* path)
{
path=str_replace(path,"/data/media/0/Android/data/com.miHoYo.Yuanshen/files/VideoAssets","/data/sdext2/ys/VideoAssets");
char* tmp=path;
path=str_replace(path,"/storage/emulated/0/Android/data/com.miHoYo.Yuanshen/files/VideoAssets","/data/sdext2/ys/VideoAssets");
if(tmp) free(tmp);
tmp=path;
path=str_replace(path,"/storage/sdcard0/Android/data/com.miHoYo.Yuanshen/files/VideoAssets","/data/sdext2/ys/VideoAssets");
if(tmp) free(tmp);
tmp=path;
path=str_replace(path,"/storage/self/primary/Android/data/com.miHoYo.Yuanshen/files/VideoAssets","/data/sdext2/ys/VideoAssets");
if(tmp) free(tmp);
tmp=path;
path=str_replace(path,"/data/data/com.miHoYo.Yuanshen/files/VideoAssets","/data/sdext2/ys/VideoAssets");
if(tmp) free(tmp);
tmp=path;
path=str_replace(path,"/mnt/user/0/emulated/0/Android/data/com.miHoYo.Yuanshen/files/VideoAssets","/data/sdext2/ys/VideoAssets");
if(tmp) free(tmp);
tmp=path;
path=str_replace(path,"/mnt/user/0/sdcard0/Android/data/com.miHoYo.Yuanshen/files/VideoAssets","/data/sdext2/ys/VideoAssets");
if(tmp) free(tmp);
tmp=path;
path=str_replace(path,"/mnt/user/0/self/primary/Android/data/com.miHoYo.Yuanshen/files/VideoAssets","/data/sdext2/ys/VideoAssets");
if(tmp) free(tmp);
tmp=path;
path=str_replace(path,"/mnt/sdcard/Android/data/com.miHoYo.Yuanshen/files/VideoAssets","/data/sdext2/ys/VideoAssets");
if(tmp) free(tmp);
tmp=path;
path=str_replace(path,"/data/user/0/com.miHoYo.Yuanshen/files/VideoAssets","/data/sdext2/ys/VideoAssets");
if(tmp) free(tmp);
tmp=path;
path=str_replace(path,"/data/user_de/0/com.miHoYo.Yuanshen/files/VideoAssets","/data/sdext2/ys/VideoAssets");
if(tmp) free(tmp);
return path;
}
int statvfs_hook(const char* path, void* status)
Expand Down

0 comments on commit 592760a

Please sign in to comment.