aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2016-07-07 12:35:25 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2016-07-07 12:35:25 +0000
commitaf219c4cff61abd088f89c8a5029af1d449a78b6 (patch)
tree2db9b452f0de5a29e4275d902e193af4ec49f501
parentf7a8e0e05cb1edadb195a311c7a4c58a6bd0daa9 (diff)
downloadgnunet-af219c4cff61abd088f89c8a5029af1d449a78b6.tar.gz
gnunet-af219c4cff61abd088f89c8a5029af1d449a78b6.zip
-coverity
-rw-r--r--src/peerstore/plugin_peerstore_flat.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/peerstore/plugin_peerstore_flat.c b/src/peerstore/plugin_peerstore_flat.c
index 5ffabed8f..fd417be05 100644
--- a/src/peerstore/plugin_peerstore_flat.c
+++ b/src/peerstore/plugin_peerstore_flat.c
@@ -394,7 +394,7 @@ database_setup (struct Plugin *plugin)
394 return GNUNET_SYSERR; 394 return GNUNET_SYSERR;
395 } 395 }
396 396
397 buffer = GNUNET_malloc (size); 397 buffer = GNUNET_malloc (size) + 1;
398 398
399 if (GNUNET_SYSERR == GNUNET_DISK_file_read (fh, 399 if (GNUNET_SYSERR == GNUNET_DISK_file_read (fh,
400 buffer, 400 buffer,
@@ -403,9 +403,12 @@ database_setup (struct Plugin *plugin)
403 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 403 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
404 _("Unable to read file: %s.\n"), 404 _("Unable to read file: %s.\n"),
405 afsdir); 405 afsdir);
406 GNUNET_DISK_file_close (fh);
407 GNUNET_free (buffer);
406 return GNUNET_SYSERR; 408 return GNUNET_SYSERR;
407 } 409 }
408 410
411 buffer[size] = '\0';
409 GNUNET_DISK_file_close (fh); 412 GNUNET_DISK_file_close (fh);
410 if (0 < size) { 413 if (0 < size) {
411 line = strtok (buffer, "\n"); 414 line = strtok (buffer, "\n");