-check return values, fix leak
authorChristian Grothoff <christian@grothoff.org>
Thu, 15 Mar 2012 13:01:56 +0000 (13:01 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 15 Mar 2012 13:01:56 +0000 (13:01 +0000)
src/fs/fs_api.c
src/fs/fs_download.c

index 669b8cc39fdde85ae60f0c7a296f25b661cef4bd..42bfaed3cc4f21aadff188572062d3484cb84d8e 100644 (file)
@@ -1985,6 +1985,7 @@ deserialize_unindex_file (void *cls, const char *filename)
     GNUNET_break (0);
     goto cleanup;
   }
+  uris = NULL;
   if ((GNUNET_OK !=
        GNUNET_BIO_read_string (rh, "unindex-fn", &uc->filename, 10 * 1024)) ||
       (GNUNET_OK != GNUNET_BIO_read_int64 (rh, &uc->file_size)) ||
@@ -1994,6 +1995,7 @@ deserialize_unindex_file (void *cls, const char *filename)
       (GNUNET_OK != GNUNET_BIO_read_string (rh, "unindex-kskuri", &uris, 10 * 1024)) ||
       (GNUNET_OK != GNUNET_BIO_read_int32 (rh, &uc->ksk_offset)) )
   {
+    GNUNET_free_non_null (uris);
     GNUNET_break (0);
     goto cleanup;
   }
index f858c58bf433e3c0a9664738087a2c7da75fa466..69298f2c92563baefa1896392e79ff9e9ada9d8a 100644 (file)
@@ -2068,7 +2068,7 @@ GNUNET_FS_download_start (struct GNUNET_FS_Handle *h,
   {
     dc->filename = GNUNET_strdup (filename);
     if (GNUNET_YES == GNUNET_DISK_file_test (filename))
-      GNUNET_DISK_file_size (filename, &dc->old_file_size, GNUNET_YES);
+      GNUNET_break (GNUNET_OK == GNUNET_DISK_file_size (filename, &dc->old_file_size, GNUNET_YES));
   }
   if (GNUNET_FS_uri_test_loc (dc->uri))
     GNUNET_assert (GNUNET_OK ==
@@ -2178,7 +2178,7 @@ GNUNET_FS_download_start_from_search (struct GNUNET_FS_Handle *h,
   {
     dc->filename = GNUNET_strdup (filename);
     if (GNUNET_YES == GNUNET_DISK_file_test (filename))
-      GNUNET_DISK_file_size (filename, &dc->old_file_size, GNUNET_YES);
+      GNUUNET_break (GNUNET_OK == GNUNET_DISK_file_size (filename, &dc->old_file_size, GNUNET_YES));
   }
   if (GNUNET_FS_uri_test_loc (dc->uri))
     GNUNET_assert (GNUNET_OK ==