mirror of
https://github.com/holub/mame
synced 2025-10-05 08:41:31 +03:00
Fixed some potential memory leaks and NULL pointer deferences as well as removing some redundant checks. [Oliver Stoneberg]
This commit is contained in:
parent
dfa747f471
commit
6742160c25
@ -239,8 +239,6 @@ const char *running_machine::describe_context()
|
||||
cpu_device *cpu = downcast<cpu_device *>(&executing->device());
|
||||
if (cpu != NULL)
|
||||
m_context.printf("'%s' (%s)", cpu->tag(), core_i64_hex_format(cpu->pc(), cpu->space(AS_PROGRAM)->logaddrchars()));
|
||||
else
|
||||
m_context.printf("'%s'", cpu->tag());
|
||||
}
|
||||
else
|
||||
m_context.cpy("(no context)");
|
||||
|
@ -1346,7 +1346,6 @@ void load_software_part_region(device_t *device, char *swlist, char *swname, rom
|
||||
|
||||
for (software_info *swinfo = software_list_find(software_list_ptr, swname, NULL); swinfo != NULL; )
|
||||
{
|
||||
if (swinfo != NULL)
|
||||
{
|
||||
astring tmp(swinfo->shortname);
|
||||
locationtag.cat(tmp);
|
||||
|
@ -86,11 +86,13 @@ wav_file *wav_open(const char *filename, int sample_rate, int channels)
|
||||
|
||||
void wav_close(wav_file *wav)
|
||||
{
|
||||
UINT32 total = ftell(wav->file);
|
||||
UINT32 total;
|
||||
UINT32 temp32;
|
||||
|
||||
if (!wav) return;
|
||||
|
||||
total = ftell(wav->file);
|
||||
|
||||
/* update the total file size */
|
||||
fseek(wav->file, wav->total_offs, SEEK_SET);
|
||||
temp32 = total - (wav->total_offs + 4);
|
||||
|
@ -318,6 +318,7 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc *outtoc, chdcd_track_
|
||||
if (memcmp(buffer, "NER5", 4))
|
||||
{
|
||||
printf("ERROR: Not a Nero 5.5 or later image!\n");
|
||||
fclose(infile);
|
||||
return CHDERR_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
@ -326,6 +327,7 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc *outtoc, chdcd_track_
|
||||
if ((buffer[7] != 0) || (buffer[6] != 0) || (buffer[5] != 0) || (buffer[4] != 0))
|
||||
{
|
||||
printf("ERROR: File size is > 4GB, this version of CHDMAN cannot handle it.");
|
||||
fclose(infile);
|
||||
return CHDERR_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
@ -427,6 +429,7 @@ chd_error chdcd_parse_nero(const char *tocfname, cdrom_toc *outtoc, chdcd_track_
|
||||
}
|
||||
}
|
||||
|
||||
fclose(infile);
|
||||
|
||||
return CHDERR_NONE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user