From: divverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Sun, 28 Nov 2010 17:11:17 +0000 (+0000)
Subject: handle a missing key more gracefully in crypto_uri_postbuf
X-Git-Tag: xonotic-v0.5.0~438^2~199
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5a9789e1e5802a9b32e38f440354cc9cb37d6281;p=xonotic%2Fdarkplaces.git

handle a missing key more gracefully in crypto_uri_postbuf

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10642 d7cf8633-e32d-0410-b094-e92efae38249
---

diff --git a/prvm_cmds.c b/prvm_cmds.c
index ef50ac65..a1aef535 100644
--- a/prvm_cmds.c
+++ b/prvm_cmds.c
@@ -5947,21 +5947,20 @@ void VM_uri_get (void)
 			if(!handle->siglen)
 			{
 				Z_Free(handle->sigdata);
-				Z_Free(handle->postdata);
-				Z_Free(handle);
-				return;
+				handle->sigdata = NULL;
+				goto out1;
 			}
 			ll = base64_encode((unsigned char *) (handle->sigdata + l), handle->siglen, 8192 - l - 1);
 			if(!ll)
 			{
 				Z_Free(handle->sigdata);
-				Z_Free(handle->postdata);
-				Z_Free(handle);
-				return;
+				handle->sigdata = NULL;
+				goto out1;
 			}
 			handle->siglen = l + ll;
 			handle->sigdata[handle->siglen] = 0;
 		}
+out1:
 		ret = Curl_Begin_ToMemory_POST(url, handle->sigdata, 0, posttype, handle->postdata, handle->postlen, (unsigned char *) handle->buffer, sizeof(handle->buffer), uri_to_string_callback, handle);
 	}
 	else
@@ -5977,19 +5976,20 @@ void VM_uri_get (void)
 			if(!handle->siglen)
 			{
 				Z_Free(handle->sigdata);
-				Z_Free(handle);
-				return;
+				handle->sigdata = NULL;
+				goto out2;
 			}
 			ll = base64_encode((unsigned char *) (handle->sigdata + l), handle->siglen, 8192 - l - 1);
 			if(!ll)
 			{
 				Z_Free(handle->sigdata);
-				Z_Free(handle);
-				return;
+				handle->sigdata = NULL;
+				goto out2;
 			}
 			handle->siglen = l + ll;
 			handle->sigdata[handle->siglen] = 0;
 		}
+out2:
 		handle->postdata = NULL;
 		handle->postlen = 0;
 		ret = Curl_Begin_ToMemory(url, 0, (unsigned char *) handle->buffer, sizeof(handle->buffer), uri_to_string_callback, handle);