[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] src/sort.c: assert on saved.text before calling memcpy()
From: |
Kovarththanan Rajaratnam |
Subject: |
[PATCH] src/sort.c: assert on saved.text before calling memcpy() |
Date: |
Wed, 6 Jan 2010 09:36:01 +0100 |
clang detected the following false positive:
sort.c:2435:15: warning: Null pointer passed as an argument to a 'nonnull'
parameter
memcpy (saved.text, smallest->text, saved.length);
^ ~~~~~~~~~~
When we reach this line saved.text is guaranteed to be non null.
Signed-off-by: Kovarththanan Rajaratnam <address@hidden>
---
src/sort.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/sort.c b/src/sort.c
index b50f6cd..010930b 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -2432,6 +2432,7 @@ mergefps (struct sortfile *files, size_t ntemps, size_t
nfiles,
saved.text = xrealloc (saved.text, savealloc);
}
saved.length = smallest->length;
+ assert(saved.text);
memcpy (saved.text, smallest->text, saved.length);
if (key)
{
--
1.6.3.3
- [PATCH] src/sort.c: assert on saved.text before calling memcpy(),
Kovarththanan Rajaratnam <=