You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by jc...@apache.org on 2008/11/12 02:02:50 UTC
svn commit: r713234 - /incubator/couchdb/trunk/src/couchdb/couch_js.c
Author: jchris
Date: Tue Nov 11 17:02:49 2008
New Revision: 713234
URL: http://svn.apache.org/viewvc?rev=713234&view=rev
Log:
fix occasional curl segfault. thanks davisp
Modified:
incubator/couchdb/trunk/src/couchdb/couch_js.c
Modified: incubator/couchdb/trunk/src/couchdb/couch_js.c
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_js.c?rev=713234&r1=713233&r2=713234&view=diff
==============================================================================
--- incubator/couchdb/trunk/src/couchdb/couch_js.c (original)
+++ incubator/couchdb/trunk/src/couchdb/couch_js.c Tue Nov 11 17:02:49 2008
@@ -786,7 +786,7 @@
curl_easy_setopt(handle,CURLOPT_HEADERFUNCTION,curl_write);
curl_easy_setopt(handle,CURLOPT_WRITEHEADER,b);
curl_easy_setopt(handle,CURLOPT_URL,url); // url
- curl_easy_setopt(handle,CURLOPT_HTTPPOST,1); // Set Op. to post
+ curl_easy_setopt(handle,CURLOPT_POST,1); // Set Op. to post
curl_easy_setopt(handle,CURLOPT_NOPROGRESS,1); // No Progress Meter
curl_easy_setopt(handle,CURLOPT_IPRESOLVE,CURL_IPRESOLVE_V4); // only ipv4
@@ -797,8 +797,8 @@
return JS_FALSE;
}
- curl_easy_setopt(handle,CURLOPT_COPYPOSTFIELDS,body); // Curl wants '\0' terminated, we oblige
- free(body);
+ curl_easy_setopt(handle,CURLOPT_POSTFIELDSIZE,strlen(body));
+ curl_easy_setopt(handle,CURLOPT_POSTFIELDS,body); // Curl wants '\0' terminated, we oblige
struct curl_slist *slist = generateCurlHeaders(context,argv+2); // Initialize Headers
if(slist != NULL) {
@@ -809,12 +809,14 @@
if((exitcode = curl_easy_perform(handle)) != 0) { // Perform
curl_slist_free_all(slist);
+ free(body);
free(url);
free_Buffer(b);
curl_easy_cleanup(handle);
return JS_FALSE;
}
+ free(body);
free(url);
curl_slist_free_all(slist);