[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r37483 - gnunet/src/peerstore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r37483 - gnunet/src/peerstore |
Date: |
Thu, 7 Jul 2016 14:42:16 +0200 |
Author: schanzen
Date: 2016-07-07 14:42:16 +0200 (Thu, 07 Jul 2016)
New Revision: 37483
Modified:
gnunet/src/peerstore/plugin_peerstore_flat.c
Log:
-coverity
Modified: gnunet/src/peerstore/plugin_peerstore_flat.c
===================================================================
--- gnunet/src/peerstore/plugin_peerstore_flat.c 2016-07-07 12:35:25 UTC
(rev 37482)
+++ gnunet/src/peerstore/plugin_peerstore_flat.c 2016-07-07 12:42:16 UTC
(rev 37483)
@@ -337,11 +337,13 @@
char *afsdir;
char *key;
char *sub_system;
- char *peer_id;
+ const char *peer_id;
+ char *peer;
char *value;
char *expiry;
struct GNUNET_DISK_FileHandle *fh;
struct GNUNET_PEERSTORE_Record *entry;
+ struct GNUNET_HashCode hkey;
size_t size;
char *buffer;
char *line;
@@ -416,8 +418,8 @@
sub_system = strtok (line, ",");
if (NULL == sub_system)
break;
- peer_id = strtok (NULL, ",");
- if (NULL == peer_id)
+ peer = strtok (NULL, ",");
+ if (NULL == peer)
break;
key = strtok (NULL, ",");
if (NULL == key)
@@ -431,15 +433,31 @@
entry = GNUNET_new (struct GNUNET_PEERSTORE_Record);
entry->sub_system = GNUNET_strdup (sub_system);
entry->key = GNUNET_strdup (key);
- GNUNET_STRINGS_base64_decode (peer_id,
- strlen (peer_id),
+ GNUNET_STRINGS_base64_decode (peer,
+ strlen (peer),
(char**)&entry->peer);
entry->value_size = GNUNET_STRINGS_base64_decode (value,
strlen (value),
(char**)&entry->value);
- GNUNET_STRINGS_fancy_time_to_absolute (expiry,
- entry->expiry);
+ if (GNUNET_SYSERR == GNUNET_STRINGS_fancy_time_to_absolute (expiry,
+ entry->expiry))
+ {
+ GNUNET_free (entry->sub_system);
+ GNUNET_free (entry->key);
+ GNUNET_free (entry->peer);
+ GNUNET_free (entry);
+ break;
+ }
+ peer_id = GNUNET_i2s (entry->peer);
+ GNUNET_CRYPTO_hash (peer_id,
+ strlen (peer_id),
+ &hkey);
+ GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put
(plugin->hm,
+ &hkey,
+ entry,
+
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE));
+
}
}
return GNUNET_OK;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r37483 - gnunet/src/peerstore,
gnunet <=