summaryrefslogtreecommitdiff
path: root/src/format/format.c
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/format.c
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/format.c')
-rw-r--r--src/format/format.c9
1 files changed, 8 insertions, 1 deletions
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++)