+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2005-2006 Silicon Graphics, Inc.
* All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <xfs/xfs.h>
-#include <xfs/command.h>
-#include <xfs/input.h>
-#include <xfs/path.h>
-#include <xfs/parent.h>
-#include <xfs/handle.h>
-#include <xfs/jdm.h>
+#include "command.h"
+#include "input.h"
+#include "path.h"
+#include "parent.h"
+#include "handle.h"
+#include "jdm.h"
#include "init.h"
#include "io.h"
break;
}
} while (error == ERANGE);
-
+
if (count == 0) {
/* no links for inode - something wrong here */
if (!bstatbuf || !parentbuf) {
fprintf(stderr, _("unable to allocate buffers: %s\n"),
strerror(errno));
- return 1;
+ err_status = 1;
+ goto out;
}
if (do_bulkstat(parentbuf, &parentbuf_size, bstatbuf, fsfd, fshandlep) != 0)
printf(_("succeeded checking %llu inodes\n"),
(unsigned long long) inodes_checked);
+out:
free(bstatbuf);
free(parentbuf);
+ free(fshandlep);
return err_status;
}
static int
parent_list(int fullpath)
{
- void *handlep;
+ void *handlep = NULL;
size_t handlen;
int error, i;
int retval = 1;
progname, path, strerror(errno));
goto error;
}
+ free_handle(fshandle, fshlen);
}
if (path_to_handle(path, &handlep, &handlen) != 0) {
if (!parentbuf) {
fprintf(stderr, _("%s: unable to allocate parent buffer: %s\n"),
progname, strerror(errno));
- return 1;
+ goto error;
}
if (fullpath) {
retval = 0;
error:
+ free(handlep);
free(parentbuf);
return retval;
}