[PVFS2-CVS] commit by neill in pvfs2/src/common/misc: pvfs2-util.c
CVS commit program
cvs at parl.clemson.edu
Fri May 7 17:53:41 EDT 2004
Update of /projects/cvsroot/pvfs2/src/common/misc
In directory parlweb:/tmp/cvs-serv14302/src/common/misc
Modified Files:
pvfs2-util.c
Log Message:
- fixes a bug that tried to free pvfstab entries that weren't allocated
Index: pvfs2-util.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/misc/pvfs2-util.c,v
diff -p -u -r1.52 -r1.53
--- pvfs2-util.c 16 Apr 2004 22:26:37 -0000 1.52
+++ pvfs2-util.c 7 May 2004 20:53:41 -0000 1.53
@@ -237,12 +237,6 @@ const PVFS_util_tab *PVFS_util_parse_pvf
strcpy(current_tab->mntent_array[i].pvfs_config_server,
tmp_ent->mnt_fsname);
last_slash++;
- current_tab->mntent_array[i].pvfs_fs_name =
- strdup(last_slash);
- if (!current_tab->mntent_array[i].pvfs_fs_name)
- {
- goto error_exit;
- }
/* mnt_dir and mnt_opts are verbatim copies */
strcpy(current_tab->mntent_array[i].mnt_dir,
@@ -250,6 +244,13 @@ const PVFS_util_tab *PVFS_util_parse_pvf
strcpy(current_tab->mntent_array[i].mnt_opts,
tmp_ent->mnt_opts);
+ current_tab->mntent_array[i].pvfs_fs_name =
+ strdup(last_slash);
+ if (!current_tab->mntent_array[i].pvfs_fs_name)
+ {
+ goto error_exit;
+ }
+
/* find out if a particular flow protocol was specified */
if ((hasmntopt(tmp_ent, "flowproto")))
{
@@ -1134,15 +1135,20 @@ static int copy_mntent(
dest_mntent->pvfs_config_server =
strdup(src_mntent->pvfs_config_server);
+ assert(dest_mntent->pvfs_config_server);
+
dest_mntent->pvfs_fs_name = strdup(src_mntent->pvfs_fs_name);
+ assert(dest_mntent->pvfs_fs_name);
if (src_mntent->mnt_dir)
{
dest_mntent->mnt_dir = strdup(src_mntent->mnt_dir);
+ assert(dest_mntent->mnt_dir);
}
if (src_mntent->mnt_opts)
{
dest_mntent->mnt_opts = strdup(src_mntent->mnt_opts);
+ assert(dest_mntent->mnt_opts);
}
dest_mntent->flowproto = src_mntent->flowproto;
dest_mntent->encoding = src_mntent->encoding;
@@ -1227,7 +1233,12 @@ void PINT_release_pvfstab(void)
{
for (j = 0; j < s_stat_tab_array[i].mntent_count; j++)
{
- PVFS_sys_free_mntent(&s_stat_tab_array[i].mntent_array[j]);
+ if (s_stat_tab_array[i].mntent_array[j].fs_id !=
+ PVFS_FS_ID_NULL)
+ {
+ PVFS_sys_free_mntent(
+ &s_stat_tab_array[i].mntent_array[j]);
+ }
}
free(s_stat_tab_array[i].mntent_array);
}
@@ -1236,9 +1247,13 @@ void PINT_release_pvfstab(void)
for (j = 0; j < s_stat_tab_array[
PVFS2_DYNAMIC_TAB_INDEX].mntent_count; j++)
{
- PVFS_sys_free_mntent(
- &s_stat_tab_array[
- PVFS2_DYNAMIC_TAB_INDEX].mntent_array[j]);
+ if (s_stat_tab_array[i].mntent_array[j].fs_id !=
+ PVFS_FS_ID_NULL)
+ {
+ PVFS_sys_free_mntent(
+ &s_stat_tab_array[
+ PVFS2_DYNAMIC_TAB_INDEX].mntent_array[j]);
+ }
}
if (s_stat_tab_array[PVFS2_DYNAMIC_TAB_INDEX].mntent_array)
{
More information about the PVFS2-CVS
mailing list