Merge "Avoid dereferencing NULL pointer with memcmp in the test code."
diff --git a/tests/bionic/libc/common/test_libgen.c b/tests/bionic/libc/common/test_libgen.c
index 4a2c29e..fd85816 100644
--- a/tests/bionic/libc/common/test_libgen.c
+++ b/tests/bionic/libc/common/test_libgen.c
@@ -76,7 +76,7 @@
             return;
         }
     }
-    else if ( memcmp( _buff, _expected_content, ret ) ) {
+    else if (_buff != NULL && memcmp( _buff, _expected_content, ret ) ) {
         fprintf(stderr,
                 "KO: basename_r(\"%s\", <buff>, %d) returned \"%s\", expected \"%s\"\n",
                 _input, _bufflen, _buff, _expected_content );
@@ -109,7 +109,7 @@
             return;
         }
     }
-    else if ( memcmp( _buff, _expected_content, ret ) ) {
+    else if (_buff != NULL &&  memcmp( _buff, _expected_content, ret ) ) {
         fprintf(stderr,
                 "KO: dirname_r(\"%s\", <buff>, %d) returned \"%s\", expected \"%s\"\n",
                 _input, _bufflen, _buff, _expected_content );