mikechambers84 / XTulator

XTulator is a portable, open source x86 PC emulator currently supporting the 8086 instruction set and 80186 extensions.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

memory leaks

LowLevelMahn opened this issue · comments

in utility_loadFile

if (fread(dst, 1, len, file) < len) {
	//debug_log(DEBUG_ERROR, "[ERROR] utility_loadFile: %s input was less than %lu bytes\r\n", srcfile, (uint32_t)len);
	free(dst);
            <-- fclose(file);
	return -1;
}

in debug_log

void debug_log(uint8_t level, char* format, ...) {
	va_list argptr;
	va_start(argptr, format);
	if (level > debug_level) { 
               <-- va_end(argptr);
            return; }
            ...

in blaster_writecmd

     blaster->dorecord = (blaster->lastcmd == 0x24) ? 1 : 0;

is always true

Thanks, good catches! I'll fix these up in the next commit. Missing va_end especially would have been an issue over a long period of time, as debug_log can be called a lot depending on the options in config.h

I pushed the memory leak fixes. I'll look at what I'm doing in blaster_writecmd later tonight.