Don't create & leak a hash table during unsuccessful open()

svn path=/trunk/; revision=22150
This commit is contained in:
Martin Mathieson 2007-06-21 17:30:13 +00:00
parent ade534a4ec
commit 1b8fccbc9d
1 changed files with 15 additions and 16 deletions

View File

@ -178,16 +178,6 @@ int catapult_dct2000_open(wtap *wth, int *err, gchar **err_info _U_)
errno = 0;
/*********************************************************************/
/* Need entry in file_externals table */
/* Create file externals table if it doesn't yet exist */
if (file_externals_table == NULL)
{
file_externals_table = g_hash_table_new(wth_hash_func, wth_equal);
}
/********************************************************************/
/* First line needs to contain at least as many characters as magic */
@ -205,6 +195,15 @@ int catapult_dct2000_open(wtap *wth, int *err, gchar **err_info _U_)
}
/*********************************************************************/
/* Need entry in file_externals table */
/* Create file externals table if it doesn't yet exist */
if (file_externals_table == NULL)
{
file_externals_table = g_hash_table_new(wth_hash_func, wth_equal);
}
/* Allocate a new file_externals structure */
file_externals = g_malloc(sizeof(dct2000_file_externals_t));
memset((void*)file_externals, '\0', sizeof(dct2000_file_externals_t));
@ -313,7 +312,7 @@ gboolean catapult_dct2000_read(wtap *wth, int *err, gchar **err_info _U_,
break;
}
/* Try to parse the line as a message */
/* Try to parse the line as a frame record */
if (parse_line(line_length, &seconds, &useconds,
&before_time_offset, &after_time_offset,
&dollar_offset,