Fixes and debugging assertions.
authorMichael Vrable <mvrable@cs.ucsd.edu>
Fri, 10 Dec 2010 19:58:25 +0000 (11:58 -0800)
committerMichael Vrable <mvrable@cs.ucsd.edu>
Fri, 10 Dec 2010 19:58:25 +0000 (11:58 -0800)
bluesky/cleaner.c
bluesky/cloudlog.c
bluesky/util.c

index ec2b5dd..d7e29eb 100644 (file)
@@ -142,8 +142,11 @@ static BlueSkyCleanerItem *bluesky_cleaner_find_checkpoint(BlueSkyFS *fs)
         length = item->length;
     }
 
-    if (length == 0)
+    if (length == 0) {
+        bluesky_cachefile_unref(cachefile);
+        g_mutex_unlock(cachefile->lock);
         return NULL;
+    }
 
     g_print("Found a cleaner checkpoint record.\n");
 
index 0570c5d..44799e3 100644 (file)
@@ -389,6 +389,7 @@ BlueSkyCloudPointer bluesky_cloudlog_serialize(BlueSkyCloudLog *log,
             bluesky_cloudlog_serialize(ref, fs);
     }
 
+    /* FIXME: Ought lock to be taken earlier? */
     g_mutex_lock(log->lock);
     bluesky_cloudlog_fetch(log);
     g_assert(log->data != NULL);
index bf1d09e..3898c4a 100644 (file)
@@ -83,6 +83,7 @@ BlueSkyRCStr *bluesky_string_new_from_mmap(BlueSkyCacheFile *mmap,
                                            int offset, gsize len)
 {
     g_assert(offset + len <= mmap->len);
+    g_assert(mmap->addr != NULL);
 
     BlueSkyRCStr *string = g_new(BlueSkyRCStr, 1);
     string->mmap = mmap;