title: Dereference before null check
body: <p>I write function to created the directory and force it to be owned by the user.</p>
  
  <pre><code>int mkdir_and_force_owner( const char *path, uid_t uid, gid_t gid )
  {
      /* deref_ptr_in_call: Dereferencing pointer "path" */
      if( mkdir( path, S_IRWXU ) &lt; 0 ) {
          if( errno != EEXIST ) {
              lfprintf( stderr, _("Cannot create %s: %s\n"), path, strerror( errno ) );
          } else {
              DIR *temp_dir = opendir( path );
              /* check_after_deref: Null-checking "path" suggests that it may be null, but it has already been dereferenced on all paths leading to the check */
              if( !path ) {
                  lfprintf( stderr, _("Cannot open %s: %s\n"), path, strerror( errno ) );
              } else {
                  closedir( temp_dir );
                  return 1;
              }
              closedir( temp_dir );
          }
      } else {
          if( chown( path, uid, gid ) &lt; 0 ) {
              lfprintf( stderr, _("Cannot change owner of %s: %s.\n"), path, strerror( errno ) );
          } else {
              return 1;
          }
      }
  
      return 0;
  }
  </code></pre>
  
  <p>but this code get this warning:</p>
  
  <p>Null-checking "path" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
  I want same help to resolve this issue
  Thanks</p>