changeset 1594:137dbd05ceab

Fix some issues identified by cppcheck
author Michael Pavone <pavone@retrodev.com>
date Fri, 29 Jun 2018 09:33:23 -0700
parents 24508cb54f87
children 360d5bab199f
files dis.c jagcpu_x86.c nuklear_ui/font_win.c util.c zdis.c zip.c
diffstat 6 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dis.c	Thu Jun 28 09:27:05 2018 -0700
+++ b/dis.c	Fri Jun 29 09:33:23 2018 -0700
@@ -206,6 +206,7 @@
 						}
 					}
 				}
+				fclose(address_log);
 			}
 		} else {
 			char *end;
--- a/jagcpu_x86.c	Thu Jun 28 09:27:05 2018 -0700
+++ b/jagcpu_x86.c	Fri Jun 29 09:33:23 2018 -0700
@@ -102,7 +102,7 @@
 	code_ptr no_delay = code-.cur + 1;
 	jcc(code, CC_NZ, no_delay + 1);
 	ccylces(code, 1);
-	*no_delay = code->cur - (no_delay = 1);
+	*no_delay = code->cur - (no_delay + 1);
 	*no_result = code->cur - (no_result + 1);
 	mov_rr(code, opts->resultreg, opts->writeback, SZ_B);
 }
@@ -122,7 +122,7 @@
 
 uint16_t *translate_jag_inst(uint16_t *stream, jag_cpu_options *opts, uint32_t address)
 {
-	uint16_t inst = *stream
+	uint16_t inst = *stream;
 	++stream;
 	uint16_t opcode = jag_opcode(inst, opts->is_gpu);
 	check_cycles_int(&opts->gen, address);
--- a/nuklear_ui/font_win.c	Thu Jun 28 09:27:05 2018 -0700
+++ b/nuklear_ui/font_win.c	Fri Jun 29 09:33:23 2018 -0700
@@ -136,6 +136,7 @@
 			free(path);
 		}
 	}
+	free(pref_prefix);
 	free(fonts);
 	free_dir_list(entries, num_entries);
 	if (selected) {
--- a/util.c	Thu Jun 28 09:27:05 2018 -0700
+++ b/util.c	Fri Jun 29 09:33:23 2018 -0700
@@ -255,8 +255,8 @@
 	if (initial < 0x80) {
 		return initial;
 	}
-	int base;
-	uint8_t extended_bytes;
+	int base = 0;
+	uint8_t extended_bytes = 0;
 	if ((initial & 0xE0) == 0xC0) {
 		base = 0x80;
 		initial &= 0x1F;
@@ -873,6 +873,7 @@
 	} else {
 		ret = NULL;
 	}
+	fclose(f);
 	return ret;
 }
 
--- a/zdis.c	Thu Jun 28 09:27:05 2018 -0700
+++ b/zdis.c	Fri Jun 29 09:33:23 2018 -0700
@@ -112,6 +112,7 @@
 						}
 					}
 				}
+				fclose(address_log);
 				break;
 			case 's':
 				opt++;
--- a/zip.c	Thu Jun 28 09:27:05 2018 -0700
+++ b/zip.c	Fri Jun 29 09:33:23 2018 -0700
@@ -176,8 +176,8 @@
 			}
 		}
 		break;
+	}
 #endif
-	}
 	default:
 		free(buf);
 		return NULL;