[Mesa-dev] [PATCH] mesa: Return nonzero length only if memcpy occurs.

Vinson Lee vlee at freedesktop.org
Wed Sep 11 18:27:43 PDT 2013


Fixes "Dereference after null check" reported by Coverity.

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 src/mesa/main/objectlabel.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c
index 90d9e09..e34df13 100644
--- a/src/mesa/main/objectlabel.c
+++ b/src/mesa/main/objectlabel.c
@@ -92,10 +92,9 @@ copy_label(char **labelPtr, char *label, int *length, int bufSize)
 {
    int labelLen = 0;
 
-   if (*labelPtr)
+   if (label && *labelPtr) {
       labelLen = strlen(*labelPtr);
 
-   if (label) {
       if (bufSize <= labelLen)
          labelLen =  bufSize-1;
 
-- 
1.8.3.2



More information about the mesa-dev mailing list