summaryrefslogtreecommitdiff
path: root/src/format
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2012-10-16 23:16:25 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2012-10-16 23:16:25 (GMT)
commit84581571e138d5b7984b6d3198296013ec157d30 (patch)
treee4308cab1f1bf85feaaeb91e33874b7ef7ccbcbb /src/format
parent6f9563a0184e36fab8d0c2c38d151827784e331e (diff)
Fixed many bugs using valgrind.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@269 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/format')
-rwxr-xr-xsrc/format/dex/dex.c2
-rw-r--r--src/format/format.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/src/format/dex/dex.c b/src/format/dex/dex.c
index 821da7a..b286f7c 100755
--- a/src/format/dex/dex.c
+++ b/src/format/dex/dex.c
@@ -255,6 +255,8 @@ static void g_dex_format_find_all_sources(GDexFormat *format)
for (i = 0; i < format->classes_count; i++)
{
source = g_dex_class_get_source_file(format->classes[i], format);
+ if (source == NULL) continue;
+
found = false;
for (k = 0; k < bf->src_count && !found; k++)
diff --git a/src/format/format.c b/src/format/format.c
index 4f6df03..f1ea4d4 100644
--- a/src/format/format.c
+++ b/src/format/format.c
@@ -503,6 +503,7 @@ bool init_all_formats(void)
GBinFormat *load_new_format(FormatType type, char *filename, bin_t **content, off_t *length)
{
GBinFormat *result; /* Adresse à retourner */
+ char *tmp; /* Nom de fichier modifiable */
GPluginModule **pglist; /* Liste de greffons */
size_t pgcount; /* Taille de cette liste */
size_t i; /* Boucle de parcours */
@@ -513,6 +514,8 @@ GBinFormat *load_new_format(FormatType type, char *filename, bin_t **content, of
+ tmp = strdup(filename);
+
pglist = get_all_plugins_for_action(PGA_FORMAT_MATCHER, &pgcount);
if (pgcount > 0)
@@ -520,7 +523,7 @@ GBinFormat *load_new_format(FormatType type, char *filename, bin_t **content, of
lnf_rescan:
for (i = 0; i < pgcount; i++)
- switch (g_plugin_module_is_matching(pglist[i], &filename, content, length))
+ switch (g_plugin_module_is_matching(pglist[i], &tmp, content, length))
{
case MFA_MATCHED:
/* FIXME */
@@ -539,6 +542,10 @@ GBinFormat *load_new_format(FormatType type, char *filename, bin_t **content, of
}
+ if (tmp == NULL)
+ free(tmp);
+
+
for (i = 0; i < FID_COUNT && result == NULL; i++)