]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
Fix a few more leaks in libxfs/xfs_repair
authorEric Sandeen <sandeen@sgi.com>
Tue, 3 Feb 2004 04:26:51 +0000 (04:26 +0000)
committerEric Sandeen <sandeen@sgi.com>
Tue, 3 Feb 2004 04:26:51 +0000 (04:26 +0000)
doc changes

doc/CHANGES
libxfs/init.c
repair/dir2.c
repair/io.c
repair/protos.h
repair/sb.c

index d6b4376e9c16c542499408f896345e2cd5413ea7..8c9fed6515c2a509a23a97cbd2ae450a501bb53d 100644 (file)
@@ -1,3 +1,6 @@
+cvs
+       - Fix a few more libxfs/repair leaks
+
 xfsprogs-2.6.3 (19 January 2003)
        - Merge Steve Langasek's work on the Debian installer
          support for xfsprogs.
index c26377c983d8daa79014f7df7c41315aab7e8568..075775f58167465d988d61204e71068e87c685ab 100644 (file)
@@ -705,5 +705,12 @@ void
 libxfs_umount(xfs_mount_t *mp)
 {
        manage_zones(1);
-       free(mp->m_perag);
+       if (mp->m_perag) {
+               int     agno;
+               for (agno = 0; agno < mp->m_maxagi; agno++) {
+                       if (mp->m_perag[agno].pagb_list)
+                               free(mp->m_perag[agno].pagb_list);
+               }
+               free(mp->m_perag);
+       }
 }
index b2629d9e26111af2ad165256fee7130edda443b0..8f878284cb7e3aaba57f058677ad4678ab57217e 100644 (file)
@@ -142,6 +142,7 @@ da_read_buf(
                                XFS_BUF_COUNT(bp));
                }
        }
+       free(bplist);
        return dabuf;
 failed:
        for (i = 0; i < nex; i++)
index 2adb4578b0361ff6be7fb041e3ba7b0b0090c77a..d5f2bbc65eb12a6a40d794249e7bd35adb92707d 100644 (file)
@@ -39,8 +39,6 @@
 void
 io_init(void)
 {
-       int i;
-
        /* open up filesystem device */
 
        ASSERT(fs_name != NULL && *fs_name != '\0');
@@ -48,27 +46,4 @@ io_init(void)
        if ((fs_fd = open (fs_name, (no_modify? O_RDONLY : O_RDWR))) < 0)  {
                do_error(_("couldn't open filesystem \"%s\"\n"), fs_name);
        }
-
-       /* initialize i/o buffers */
-
-       iobuf_size = 1000 * 1024;
-       smallbuf_size = 4 * 4096;       /* enough for an ag */
-
-       /*
-        * sbbuf_size must be < XFS_MIN_AG_BLOCKS (64) * smallest block size,
-        * otherwise you might get an EOF when reading in the sb/agf from
-        * the last ag if that ag is small
-        */
-       sbbuf_size = 2 * 4096;          /* 2 * max sector size */
-
-       if ((iobuf = malloc(iobuf_size)) == NULL)
-               do_error(_("couldn't malloc io buffer\n"));
-
-       if ((smallbuf = malloc(smallbuf_size)) == NULL)
-               do_error(_("couldn't malloc secondary io buffer\n"));
-
-       for (i = 0; i < NUM_SBS; i++)  {
-               if ((sb_bufs[i] = malloc(sbbuf_size)) == NULL)
-                       do_error(_("couldn't malloc sb io buffers\n"));
-       }
 }
index 374d3878a3568d19b6073c428c5c889ffed2a140..175989bed83328af21bff1931bf7bb653c7ce457 100644 (file)
@@ -47,8 +47,6 @@ void  write_primary_sb(xfs_sb_t       *sbp,
 
 int    find_secondary_sb(xfs_sb_t      *sb);
 
-int    check_growfs(xfs_off_t off, int bufnum, xfs_agnumber_t agnum);
-
 void   get_sb_geometry(fs_geometry_t   *geo,
                        xfs_sb_t        *sbp);
 
index 3eea31c96f7e0bc9edf3d0f3df4e0a4a15b8e566..079559be59d4826f4bdc834cdcd5dfa899b640f9 100644 (file)
@@ -524,31 +524,6 @@ get_sb(xfs_sb_t *sbp, xfs_off_t off, int size, xfs_agnumber_t agno)
        return (verify_sb(sbp, 0));
 }
 
-#if 0
-int
-check_growfs(xfs_off_t off, int bufnum, xfs_agnumber_t agnum)
-{
-       int rval;
-
-       ASSERT(bufnum < NUM_SBS);
-
-       /* try and read it first */
-
-       if (lseek64(fs_fd, off, SEEK_SET) != off)
-               return(XR_EOF);
-
-       if ((rval = read(fs_fd, sb_bufs[bufnum], sbbuf_size)) != sbbuf_size)  {
-               /*
-                * we didn't get a full block so the filesystem
-                * could not have been grown.  return a non-XR_OK
-                * result code.
-                */
-               return(XR_EOF);
-       }
-
-       return(get_sb(off, bufnum, agnum));
-}
-#endif
 /* returns element on list with highest reference count */
 
 fs_geo_list_t *