memif: coverity fix 86/15186/2
authorJakub Grajciar <jgrajcia@cisco.com>
Tue, 9 Oct 2018 08:02:46 +0000 (10:02 +0200)
committerJakub Grajciar <jgrajcia@cisco.com>
Tue, 9 Oct 2018 08:07:41 +0000 (10:07 +0200)
Change-Id: I2b14e2a035a37b04816aac1e610146be58ad1e92
Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
src/plugins/memif/memif.c

index 63f72a3..e8fb0e9 100644 (file)
@@ -680,8 +680,10 @@ memif_socket_filename_add_del (u8 is_add, u32 sock_id, u8 * sock_filename)
        }
 
       /* check dir existance and access rights for effective user/group IDs */
-      if (faccessat ( /* ignored */ -1, dir, F_OK | R_OK | W_OK, AT_EACCESS) <
-         0)
+      if ((dir == NULL)
+         ||
+         (faccessat ( /* ignored */ -1, dir, F_OK | R_OK | W_OK, AT_EACCESS)
+          < 0))
        {
          vec_free (dir);
          return VNET_API_ERROR_INVALID_ARGUMENT;