mirror of
https://github.com/wiiu-env/libiosuhax.git
synced 2024-11-27 11:34:15 +01:00
Fix use after free
This commit is contained in:
parent
153d10acf9
commit
15a9847ae5
@ -462,8 +462,9 @@ static int fs_dev_stat_r(struct _reent *r, const char *path, struct stat *st) {
|
|||||||
|
|
||||||
FSStat stats;
|
FSStat stats;
|
||||||
int result = IOSUHAX_FSA_GetStat(dev->fsaFd, real_path, &stats);
|
int result = IOSUHAX_FSA_GetStat(dev->fsaFd, real_path, &stats);
|
||||||
free(real_path);
|
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
free(real_path);
|
||||||
r->_errno = fs_dev_translate_error(result);
|
r->_errno = fs_dev_translate_error(result);
|
||||||
OSUnlockMutex(dev->pMutex);
|
OSUnlockMutex(dev->pMutex);
|
||||||
return -1;
|
return -1;
|
||||||
@ -484,6 +485,8 @@ static int fs_dev_stat_r(struct _reent *r, const char *path, struct stat *st) {
|
|||||||
st->st_ctime = fs_dev_translate_time(stats.created);
|
st->st_ctime = fs_dev_translate_time(stats.created);
|
||||||
st->st_mtime = fs_dev_translate_time(stats.modified);
|
st->st_mtime = fs_dev_translate_time(stats.modified);
|
||||||
|
|
||||||
|
free(real_path);
|
||||||
|
|
||||||
OSUnlockMutex(dev->pMutex);
|
OSUnlockMutex(dev->pMutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -509,8 +512,8 @@ static int fs_dev_lstat_r(struct _reent *r, const char *path, struct stat *st) {
|
|||||||
|
|
||||||
FSStat stats;
|
FSStat stats;
|
||||||
int result = IOSUHAX_FSA_GetStat(dev->fsaFd, real_path, &stats);
|
int result = IOSUHAX_FSA_GetStat(dev->fsaFd, real_path, &stats);
|
||||||
free(real_path);
|
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
free(real_path);
|
||||||
r->_errno = fs_dev_translate_error(result);
|
r->_errno = fs_dev_translate_error(result);
|
||||||
OSUnlockMutex(dev->pMutex);
|
OSUnlockMutex(dev->pMutex);
|
||||||
return -1;
|
return -1;
|
||||||
@ -531,6 +534,8 @@ static int fs_dev_lstat_r(struct _reent *r, const char *path, struct stat *st) {
|
|||||||
st->st_ctime = fs_dev_translate_time(stats.created);
|
st->st_ctime = fs_dev_translate_time(stats.created);
|
||||||
st->st_mtime = fs_dev_translate_time(stats.modified);
|
st->st_mtime = fs_dev_translate_time(stats.modified);
|
||||||
|
|
||||||
|
free(real_path);
|
||||||
|
|
||||||
OSUnlockMutex(dev->pMutex);
|
OSUnlockMutex(dev->pMutex);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user