Don't cast the return from calloc()
[openafs.git] / src / volser / vol-dump.c
index 2924bb1..47a7cc0 100644 (file)
@@ -54,9 +54,10 @@ int VolumeChanged;           /* needed by physio - leave alone */
 int verbose = 0;
 
 /* Forward Declarations */
-void HandleVolume(struct DiskPartition64 *partP, char *name, char *filename, int fromtime);
-Volume *AttachVolume(struct DiskPartition64 *dp, char *volname,
-                    struct VolumeHeader *header);
+static void HandleVolume(struct DiskPartition64 *partP, char *name,
+                        char *filename, int fromtime);
+static Volume *AttachVolume(struct DiskPartition64 *dp, char *volname,
+                           struct VolumeHeader *header);
 static void DoMyVolDump(Volume * vp, struct DiskPartition64 *dp,
                        char *dumpfile, int fromtime);
 
@@ -67,7 +68,7 @@ static void DoMyVolDump(Volume * vp, struct DiskPartition64 *dp,
 char name[VMAXPATHLEN];
 
 
-int
+static int
 ReadHdr1(IHandle_t * ih, char *to, int size, u_int magic, u_int version)
 {
     int code;
@@ -80,7 +81,7 @@ ReadHdr1(IHandle_t * ih, char *to, int size, u_int magic, u_int version)
 }
 
 
-Volume *
+static Volume *
 AttachVolume(struct DiskPartition64 * dp, char *volname,
             struct VolumeHeader * header)
 {
@@ -102,7 +103,7 @@ AttachVolume(struct DiskPartition64 * dp, char *volname,
     vp->shuttingDown = 0;
     vp->goingOffline = 0;
     vp->nUsers = 1;
-    vp->header = (struct volHeader *)calloc(1, sizeof(*vp->header));
+    vp->header = calloc(1, sizeof(*vp->header));
     ec = ReadHdr1(V_diskDataHandle(vp), (char *)&V_disk(vp),
                  sizeof(V_disk(vp)), VOLUMEINFOMAGIC, VOLUMEINFOVERSION);
     if (!ec) {
@@ -209,7 +210,7 @@ handleit(struct cmd_syndesc *as, void *arock)
     return 0;
 }
 
-void
+static void
 HandleVolume(struct DiskPartition64 *dp, char *name, char *filename, int fromtime)
 {
     struct VolumeHeader header;
@@ -252,6 +253,8 @@ HandleVolume(struct DiskPartition64 *dp, char *name, char *filename, int fromtim
     }
 
     DoMyVolDump(vp, dp, filename, fromtime);
+
+    free(vp);
 }