summaryrefslogtreecommitdiff
path: root/lib/talloc/talloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/talloc/talloc.c')
-rw-r--r--lib/talloc/talloc.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index 0126567c45..8e91b60c99 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -1227,7 +1227,16 @@ size_t talloc_total_size(const void *ptr)
size_t talloc_total_blocks(const void *ptr)
{
size_t total = 0;
- struct talloc_chunk *c, *tc = talloc_chunk_from_ptr(ptr);
+ struct talloc_chunk *c, *tc;
+
+ if (ptr == NULL) {
+ ptr = null_context;
+ }
+ if (ptr == NULL) {
+ return 0;
+ }
+
+ tc = talloc_chunk_from_ptr(ptr);
if (tc->flags & TALLOC_FLAG_LOOP) {
return 0;
@@ -1807,8 +1816,12 @@ size_t talloc_get_size(const void *context)
{
struct talloc_chunk *tc;
- if (context == NULL)
+ if (context == NULL) {
+ context = null_context;
+ }
+ if (context == NULL) {
return 0;
+ }
tc = talloc_chunk_from_ptr(context);