mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-11-25 13:35:12 +00:00
Fix bugs pointed out by valgrind
This commit is contained in:
parent
c2ee370182
commit
660e787502
5 changed files with 17 additions and 9 deletions
|
@ -176,10 +176,10 @@ extern struct Camera *gCamera;
|
|||
* Lakitu's position and focus.
|
||||
* @see LakituState
|
||||
*/
|
||||
struct LakituState gLakituState;
|
||||
struct CameraFOVStatus sFOVState;
|
||||
struct TransitionInfo sModeTransition;
|
||||
struct PlayerGeometry sMarioGeometry;
|
||||
struct LakituState gLakituState = { 0 };
|
||||
struct CameraFOVStatus sFOVState = { 0 };
|
||||
struct TransitionInfo sModeTransition = { 0 };
|
||||
struct PlayerGeometry sMarioGeometry = { 0 };
|
||||
struct Camera *gCamera;
|
||||
s16 unusedFreeRoamWallYaw;
|
||||
s16 sAvoidYawVel;
|
||||
|
|
|
@ -298,8 +298,10 @@ void configfile_load(const char *filename) {
|
|||
while (isspace(*p))
|
||||
p++;
|
||||
|
||||
if (!*p || *p == '#') // comment or empty line
|
||||
if (!*p || *p == '#') { // comment or empty line
|
||||
free(line);
|
||||
continue;
|
||||
}
|
||||
|
||||
numTokens = tokenize_string(p, sizeof(tokens) / sizeof(tokens[0]), tokens);
|
||||
if (numTokens != 0) {
|
||||
|
@ -315,12 +317,14 @@ void configfile_load(const char *filename) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
free(line);
|
||||
continue;
|
||||
}
|
||||
|
||||
// ban list
|
||||
if (!strcmp(tokens[0], "ban:")) {
|
||||
ban_list_add(tokens[1], true);
|
||||
free(line);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
|
||||
static void _debuglog_print_timestamp(void) {
|
||||
time_t ltime = time(NULL);
|
||||
char* str = asctime(localtime(<ime));
|
||||
struct tm ltime2 = { 0 };
|
||||
localtime_r(<ime, <ime2);
|
||||
char* str = asctime(<ime2);
|
||||
printf("%.*s", (int)strlen(str) - 1, str);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,9 @@ void logfile_close(enum LogFileType logFileType);
|
|||
static void _logfile_print_timestamp(enum LogFileType logFileType) {
|
||||
FILE* f = gLogFiles[logFileType].file;
|
||||
time_t ltime = time(NULL);
|
||||
char* str = asctime(localtime(<ime));
|
||||
struct tm ltime2 = { 0 };
|
||||
localtime_r(<ime, <ime2);
|
||||
char* str = asctime(<ime2);
|
||||
fprintf(f, "%.*s", (int)strlen(str) - 1, str);
|
||||
}
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ void main_func(void) {
|
|||
configWindow.fullscreen = false;
|
||||
|
||||
const size_t poolsize = gCLIOpts.PoolSize ? gCLIOpts.PoolSize : DEFAULT_POOL_SIZE;
|
||||
u64 *pool = malloc(poolsize);
|
||||
u64 *pool = calloc(poolsize, 1);
|
||||
if (!pool) sys_fatal("Could not alloc %u bytes for main pool.\n", poolsize);
|
||||
main_pool_init(pool, pool + poolsize / sizeof(pool[0]));
|
||||
gEffectsMemoryPool = mem_pool_init(0x4000, MEMORY_POOL_LEFT);
|
||||
|
|
Loading…
Reference in a new issue