fixing double free, missing free, use of undef key
authorChristian Grothoff <christian@grothoff.org>
Sat, 1 May 2010 12:17:38 +0000 (12:17 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 1 May 2010 12:17:38 +0000 (12:17 +0000)
src/fs/fs.c
src/fs/fs_directory.c
src/fs/fs_download.c
src/fs/fs_file_information.c

index c25e1919e736331a85ba3ba475260c4df4a071e3..94777fb05926bb09a20f6942e99b6a624d6ab3ec 100644 (file)
@@ -663,6 +663,8 @@ deserialize_fi_node (struct GNUNET_FS_Handle *h,
       GNUNET_free (filename);
       filename = NULL;
     }
+  GNUNET_free_non_null (ksks);
+  GNUNET_free_non_null (chks);
   return ret;
  cleanup:
   GNUNET_free_non_null (ksks);
@@ -1077,6 +1079,7 @@ deserialize_publish_file (void *cls,
       pc->fi_pos = find_file_position (pc->fi,
                                       fi_pos);
       GNUNET_free (fi_pos);
+      fi_pos = NULL;
       if (pc->fi_pos == NULL)
        {
          /* failed to find position for resuming, outch! Will start from root! */
@@ -1106,11 +1109,13 @@ deserialize_publish_file (void *cls,
                  emsg);
       GNUNET_free (emsg);
     }
+  GNUNET_free_non_null (ns);
   return GNUNET_OK;
  cleanup:
   GNUNET_free_non_null (pc->nid);
   GNUNET_free_non_null (pc->nuid);
   GNUNET_free_non_null (fi_root);
+  GNUNET_free_non_null (fi_pos);
   GNUNET_free_non_null (ns);
   if ( (rh != NULL) &&
        (GNUNET_OK !=
index e4d02b5635e5f18cd6a2a43484afdcc482c53435..9c13073ab1707cdc86d777b7a98c3fd145cc7d0d 100644 (file)
@@ -627,6 +627,9 @@ GNUNET_FS_directory_builder_finish (struct GNUNET_FS_DirectoryBuilder *bld,
                           "malloc");
       *rsize = 0;
       *rdata = NULL;
+      GNUNET_free_non_null (sizes);
+      GNUNET_free_non_null (perm);
+      GNUNET_free_non_null (bes);
       return GNUNET_SYSERR;
     }
   *rdata = data;
index d36c60ccc64e608d025f9dd82abcca1ba9f142ea..eba58e7a5678a36cca27127fcd4f76c68ab0cff4 100644 (file)
@@ -313,6 +313,7 @@ schedule_block_download (struct GNUNET_FS_DownloadContext *dc,
                               block,
                               len)) )
     {
+      GNUNET_CRYPTO_hash (block, len, &key);
       if (0 == memcmp (&key,
                       &chk->key,
                       sizeof (GNUNET_HashCode)))
index df53bcc1cebb5792dd8bbed3fcc8df29e2dcca7e..d9acc959563b1a8f6c2916a0f440a7cd1ad9defa 100644 (file)
@@ -741,7 +741,6 @@ GNUNET_FS_file_information_destroy (struct GNUNET_FS_FileInformation *fi,
                 &fi->client_info);
     }
   GNUNET_free_non_null (fi->filename);
-  GNUNET_free_non_null (fi->serialization);
   GNUNET_free_non_null (fi->emsg);
   GNUNET_free_non_null (fi->chk_uri);
   /* clean up serialization */