Fixed undefined behavior in wf_peer_main_loop function
authorAbhineet-Ayan-Verma <abhineet.ayan.verma@gmail.com>
Wed, 15 Feb 2017 10:26:44 +0000 (15:56 +0530)
committerGitHub <noreply@github.com>
Wed, 15 Feb 2017 10:26:44 +0000 (15:56 +0530)
Undefined behavior on "wfPeerContext *context", as it is accessed before being initialized or assigned. Fixed.

server/Windows/wf_peer.c

index a23604c..7065e16 100644 (file)
@@ -279,11 +279,11 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
        if (!client->Initialize(client))
                goto fail_client_initialize;
 
+       context = (wfPeerContext*) client->context;
+       
        if (context->socketClose)
                goto fail_socked_closed;
 
-       context = (wfPeerContext*) client->context;
-
        wfi = context->info;
 
        if (wfi->input_disabled)