Hi,

> The return value of MapViewOfFile must be passed to UnmapViewofFile,
> instead of the file handle.

Good catch!

> Fixes #206

Strangely enough, I am not able to reproduce this bug - I posted logs
to the GitHub issue.

Fix indeed makes sense. Indeed, according to docs, UnmapViewOfFile()
accepts return value from MapViewOfFile(),
not from CreateFileMapping(), like it is implemented in interactive
service. Interesting that in tun.c implementation
is correct.

> -    if (handle && *handle && *handle != INVALID_HANDLE_VALUE)
> +    if (ring && *ring)
>      {
> -        UnmapViewOfFile(*handle);
> -        *handle = INVALID_HANDLE_VALUE;
> +        UnmapViewOfFile(*ring);
>      }
> -    return INVALID_HANDLE_VALUE;
> +    *ring = NULL;

It makes sense to move NULL assignment inside if { } to handle
unlikely case when the passed "ring" is NULL.


_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to