diff options
Diffstat (limited to 'src/analysis')
-rw-r--r-- | src/analysis/binaries/file.c | 5 | ||||
-rw-r--r-- | src/analysis/binary.c | 14 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/analysis/binaries/file.c b/src/analysis/binaries/file.c index 0be1fd7..46307fb 100644 --- a/src/analysis/binaries/file.c +++ b/src/analysis/binaries/file.c @@ -162,7 +162,6 @@ GLoadedBinary *g_file_binary_new_from_file(const char *filename) { GFileBinary *result; /* Adresse à retourner */ GLoadedBinary *loaded; /* Version parente */ - char *tmp; /* Nom de fichier modifiable */ result = g_object_new(G_TYPE_FILE_BINARY, NULL); loaded = G_LOADED_BINARY(result); @@ -171,10 +170,8 @@ GLoadedBinary *g_file_binary_new_from_file(const char *filename) result->filename = strdup(filename); - tmp = strdup(filename); - loaded->format = G_EXE_FORMAT(load_new_format(FMT_EXEC, tmp, + loaded->format = G_EXE_FORMAT(load_new_format(FMT_EXEC, filename, &loaded->bin_data, &loaded->bin_length)); - free(tmp); if (loaded->format == NULL) { diff --git a/src/analysis/binary.c b/src/analysis/binary.c index fe8188b..d5bf029 100644 --- a/src/analysis/binary.c +++ b/src/analysis/binary.c @@ -733,7 +733,10 @@ GCodeBuffer *g_loaded_binary_get_decompiled_buffer(const GLoadedBinary *binary, { GCodeBuffer *result; /* Tampon à retourner */ - if (index >= binary->decbuf_count) + if (binary->decbuf_count == 0) + result = NULL; + + else if (index >= binary->decbuf_count) result = binary->dec_buffers[binary->defsrc]; else @@ -792,11 +795,14 @@ void ack_completed_disassembly(void/*GDelayedDisassembly*/ *disass, GLoadedBinar files = g_binary_format_get_source_files(G_BIN_FORMAT(binary->format), &binary->decbuf_count, &binary->defsrc); - binary->dec_buffers = (GCodeBuffer **)calloc(binary->decbuf_count, sizeof(GCodeBuffer *)); + if (binary->decbuf_count > 0) + { + binary->dec_buffers = (GCodeBuffer **)calloc(binary->decbuf_count, sizeof(GCodeBuffer *)); - for (i = 0; i < binary->decbuf_count; i++) - binary->dec_buffers[i] = decompile_all_from_file(binary, files[i]); + for (i = 0; i < binary->decbuf_count; i++) + binary->dec_buffers[i] = decompile_all_from_file(binary, files[i]); + } |