mirror of
https://github.com/joel16/VITAlbum.git
synced 2025-02-18 17:57:49 +00:00
Fix mem alloc derp
This commit is contained in:
parent
e9673b1b13
commit
2b260dd152
@ -7,6 +7,7 @@
|
||||
#include <filesystem>
|
||||
|
||||
#include "fs.h"
|
||||
#include "log.h"
|
||||
#include "utils.h"
|
||||
|
||||
namespace FS {
|
||||
@ -65,11 +66,16 @@ namespace FS {
|
||||
SceUID dir = 0;
|
||||
|
||||
entry_count = CountFiles(path) + ((path == "ux0:")? 0 : 1);
|
||||
Log::Debug("entry_count(%s) = %llu\n", path.c_str(), entry_count);
|
||||
|
||||
if (R_FAILED(dir = sceIoDopen(path.c_str())))
|
||||
if (R_FAILED(dir = sceIoDopen(path.c_str()))) {
|
||||
Log::Debug("sceIoDopen failed 0x%08x\n", dir);
|
||||
return dir;
|
||||
|
||||
SceIoDirent *entries = new SceIoDirent[entry_count * sizeof(*entries)];
|
||||
}
|
||||
|
||||
Log::Debug("Before malloc\n");
|
||||
SceIoDirent *entries = new SceIoDirent[entry_count * sizeof(entries)];
|
||||
Log::Debug("After malloc\n");
|
||||
|
||||
// Add parent directory entry if not on root path
|
||||
if (path != "ux0:") {
|
||||
@ -85,6 +91,7 @@ namespace FS {
|
||||
std::qsort(entries, entry_count, sizeof(SceIoDirent), sort);
|
||||
|
||||
if (R_FAILED(ret = sceIoDclose(dir))) {
|
||||
Log::Debug("sceIoDopen failed 0x%08x\n", ret);
|
||||
delete entries;
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user