--- conduits/backup/backup_conduit.c~	2003-03-18 10:12:25.000000000 -0500
+++ conduits/backup/backup_conduit.c	2005-06-27 10:00:46.000000000 -0400
@@ -54,7 +54,7 @@
 typedef struct file_db {
         gchar fname[256];
 	struct DBInfo info;
-        gint maxblock;
+        size_t maxblock;
 	gint entries;
 } file_db;
 
@@ -377,7 +377,7 @@
 					gpointer _cfg)
 {
 	char *name;
-	struct pi_file *f;
+	struct pi_file *f = NULL;
 	struct stat statb;
 	struct utimbuf times;
 	GList *iterator;
@@ -576,8 +576,10 @@
 		gnome_pilot_conduit_send_error(GNOME_PILOT_CONDUIT(conduit),
 					       "Unable to write file to backup directory specified");
 		result = -1;
+		f = NULL;
 		goto db_close;
 	}
+	f = NULL;
 	
 	g_message ("Wrote %d of %d %s, which is %s",
 		   wrote, entries, PI_DBINFO (dbinfo)->flags & dlpDBFlagResource ? "resources" : "records",
@@ -589,6 +591,7 @@
  db_close:
 	dlp_CloseDB (dbinfo->pilot_socket, dbinfo->db_handle);
  exit_and_free:
+	pi_file_close (f);
 	g_free (name);
  exit:	
 	return result;	
@@ -621,10 +624,10 @@
 {
 	DIR *dir;
 	struct dirent *dirent;
-	GnomePilotDBInfo info;
 	file_db **db;
 	int dbcount = 0;
-	int i, j, max, size;
+	int i, j, max;
+	size_t size;
 	struct pi_file *file;
 	char *source;
 	int result = 0;
@@ -679,7 +682,7 @@
 
 		/* Find biggest record */
 		for (i = 0; i < db[dbcount]->entries; i++) {
-			if (PI_DBINFO (&info)->flags & dlpDBFlagResource)
+			if (db[dbcount]->info.flags & dlpDBFlagResource)
 				pi_file_read_resource(file, i, 0, &size, 0, 0);
 			else
 				pi_file_read_record(file, i, 0, &size, 0, 0,0 );
