aboutsummaryrefslogtreecommitdiff
path: root/src/fs
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-09-04 12:42:02 +0000
committerChristian Grothoff <christian@grothoff.org>2012-09-04 12:42:02 +0000
commit3689a7346e8529c258225c5058bdc148efb39cd9 (patch)
tree00d9c2226d721307ccea9dedce7451d42a0d0ba4 /src/fs
parent2ece5c39ccabb8bd1450dcf75d145b062f9d02f6 (diff)
downloadgnunet-3689a7346e8529c258225c5058bdc148efb39cd9.tar.gz
gnunet-3689a7346e8529c258225c5058bdc148efb39cd9.zip
-fixing potential NULL deref
Diffstat (limited to 'src/fs')
-rw-r--r--src/fs/gnunet-service-fs_pr.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c
index 3c12edfb9..cbe5a3e24 100644
--- a/src/fs/gnunet-service-fs_pr.c
+++ b/src/fs/gnunet-service-fs_pr.c
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2009, 2010, 2011 Christian Grothoff (and other contributing authors) 3 (C) 2009, 2010, 2011, 2012 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -1511,10 +1511,7 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
1511 GNUNET_NO); 1511 GNUNET_NO);
1512 /* now, lookup 'query' */ 1512 /* now, lookup 'query' */
1513 prq.data = (const void *) &put[1]; 1513 prq.data = (const void *) &put[1];
1514 if (NULL != cp) 1514 prq.sender = cp;
1515 prq.sender = cp;
1516 else
1517 prq.sender = NULL;
1518 prq.size = dsize; 1515 prq.size = dsize;
1519 prq.type = type; 1516 prq.type = type;
1520 prq.expiration = expiration; 1517 prq.expiration = expiration;
@@ -1531,6 +1528,7 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
1531 GSF_get_peer_performance_data_ (cp)->respect += prq.priority; 1528 GSF_get_peer_performance_data_ (cp)->respect += prq.priority;
1532 } 1529 }
1533 if ((GNUNET_YES == active_to_migration) && 1530 if ((GNUNET_YES == active_to_migration) &&
1531 (NULL != cp) &&
1534 (GNUNET_NO == test_put_load_too_high (prq.priority))) 1532 (GNUNET_NO == test_put_load_too_high (prq.priority)))
1535 { 1533 {
1536 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1534 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1553,7 +1551,7 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
1553 put_migration_continuation (pmc, GNUNET_SYSERR, GNUNET_TIME_UNIT_ZERO_ABS, NULL); 1551 put_migration_continuation (pmc, GNUNET_SYSERR, GNUNET_TIME_UNIT_ZERO_ABS, NULL);
1554 } 1552 }
1555 } 1553 }
1556 else 1554 else if (NULL != cp)
1557 { 1555 {
1558 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1556 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1559 "Choosing not to keep content `%s' (%d/%d)\n", 1557 "Choosing not to keep content `%s' (%d/%d)\n",
@@ -1561,9 +1559,10 @@ GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp,
1561 test_put_load_too_high (prq.priority)); 1559 test_put_load_too_high (prq.priority));
1562 } 1560 }
1563 putl = GNUNET_LOAD_get_load (datastore_put_load); 1561 putl = GNUNET_LOAD_get_load (datastore_put_load);
1564 if ((NULL != (cp = prq.sender)) && (GNUNET_NO == prq.request_found) && 1562 if ( (NULL != cp) &&
1565 ((GNUNET_YES != active_to_migration) || 1563 (GNUNET_NO == prq.request_found) &&
1566 (putl > 2.5 * (1 + prq.priority)))) 1564 ( (GNUNET_YES != active_to_migration) ||
1565 (putl > 2.5 * (1 + prq.priority)) ) )
1567 { 1566 {
1568 if (GNUNET_YES != active_to_migration) 1567 if (GNUNET_YES != active_to_migration)
1569 putl = 1.0 + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 5); 1568 putl = 1.0 + GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, 5);