From: Christian Grothoff Date: Sat, 1 May 2010 12:17:38 +0000 (+0000) Subject: fixing double free, missing free, use of undef key X-Git-Tag: initial-import-from-subversion-38251~21928 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f1df9f057d50cd695ee3b86538f27306ea74369f;p=oweals%2Fgnunet.git fixing double free, missing free, use of undef key --- diff --git a/src/fs/fs.c b/src/fs/fs.c index c25e1919e..94777fb05 100644 --- a/src/fs/fs.c +++ b/src/fs/fs.c @@ -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 != diff --git a/src/fs/fs_directory.c b/src/fs/fs_directory.c index e4d02b563..9c13073ab 100644 --- a/src/fs/fs_directory.c +++ b/src/fs/fs_directory.c @@ -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; diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index d36c60ccc..eba58e7a5 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c @@ -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))) diff --git a/src/fs/fs_file_information.c b/src/fs/fs_file_information.c index df53bcc1c..d9acc9595 100644 --- a/src/fs/fs_file_information.c +++ b/src/fs/fs_file_information.c @@ -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 */