Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit c1754e19 authored by rswindell's avatar rswindell

Address Coverity defects 33325-33480, etc. Resource Leak:

HANDLE_PENDING() contains a return, so it's theoretically possible that the
memory allocated by the previous JSVALUE/STRING_TO_... allocation could
be leaked. So now we pass an optional pointer to HANDLE_PENDING() which will
call free() on it if it's not NULL, and then sets it to NULL for good measure.
parent 9838b604
......@@ -400,7 +400,7 @@ js_write(JSContext *cx, uintN argc, jsval *arglist)
JSString* str=NULL;
FILE* fp;
jsrefcount rc;
char *p;
char *p = NULL;
size_t len;
JS_SET_RVAL(cx, arglist, JSVAL_VOID);
......@@ -413,7 +413,7 @@ js_write(JSContext *cx, uintN argc, jsval *arglist)
if (!str)
return JS_FALSE;
JSSTRING_TO_MSTRING(cx, str, p, &len);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, p);
rc=JS_SUSPENDREQUEST(cx);
if(p) {
fwrite(p, len, 1, fp);
......
......@@ -772,7 +772,7 @@ static JSBool js_bbs_set(JSContext *cx, JSObject *obj, jsid id, JSBool strict, j
if((js_str = JS_ValueToString(cx, *vp))==NULL)
return(JS_FALSE);
JSSTRING_TO_MSTRING(cx, js_str, p, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, p);
}
switch(tiny) {
......@@ -4000,7 +4000,7 @@ static JSBool js_bbs_resolve(JSContext *cx, JSObject *obj, jsid id)
JS_IdToValue(cx, id, &idval);
if(JSVAL_IS_STRING(idval)) {
JSSTRING_TO_MSTRING(cx, JSVAL_TO_STRING(idval), name, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, name);
}
}
......
......@@ -170,7 +170,7 @@ js_send(JSContext *cx, uintN argc, jsval *arglist)
{
JSObject *obj=JS_THIS_OBJECT(cx, arglist);
jsval *argv=JS_ARGV(cx, arglist);
char* cp;
char* cp = NULL;
size_t len;
private_t* p;
jsrefcount rc;
......@@ -188,7 +188,7 @@ js_send(JSContext *cx, uintN argc, jsval *arglist)
JS_SET_RVAL(cx, arglist, JSVAL_FALSE);
JSVALUE_TO_MSTRING(cx, argv[0], cp, &len);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
rc=JS_SUSPENDREQUEST(cx);
if(cp && comWriteBuf(p->com,(uint8_t *)cp,len)==len) {
......@@ -212,7 +212,7 @@ js_sendfile(JSContext *cx, uintN argc, jsval *arglist)
jsval *argv=JS_ARGV(cx, arglist);
long len;
int file;
char* fname;
char* fname = NULL;
private_t* p;
jsrefcount rc;
char *buf;
......@@ -230,7 +230,7 @@ js_sendfile(JSContext *cx, uintN argc, jsval *arglist)
JS_SET_RVAL(cx, arglist, JSVAL_FALSE);
JSVALUE_TO_MSTRING(cx, argv[0], fname, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, fname);
if(fname==NULL) {
JS_ReportError(cx,"Failure reading filename");
return(JS_FALSE);
......@@ -766,7 +766,7 @@ static JSBool js_com_resolve(JSContext *cx, JSObject *obj, jsid id)
JS_IdToValue(cx, id, &idval);
if(JSVAL_IS_STRING(idval)) {
JSSTRING_TO_MSTRING(cx, JSVAL_TO_STRING(idval), name, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, name);
}
}
......@@ -802,13 +802,13 @@ js_com_constructor(JSContext *cx, uintN argc, jsval *arglist)
JSObject *obj;
jsval *argv=JS_ARGV(cx, arglist);
private_t* p;
char* fname;
char* fname = NULL;
obj=JS_NewObject(cx, &js_com_class, NULL, NULL);
JS_SET_RVAL(cx, arglist, OBJECT_TO_JSVAL(obj));
if(argc > 0) {
JSVALUE_TO_MSTRING(cx, argv[0], fname, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, fname);
}
if(argc==0 || fname==NULL) {
JS_ReportError(cx,"Failure reading port name");
......
......@@ -235,10 +235,10 @@ static JSBool js_set(JSContext *cx, JSObject *obj, jsid id, JSBool strict, jsval
case PROP_CLIPBOARD:
{
size_t len;
char *bytes;
char *bytes = NULL;
JSVALUE_TO_MSTRING(cx, *vp, bytes, &len);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, bytes);
if(!bytes)
return JS_FALSE;
rc=JS_SUSPENDREQUEST(cx);
......@@ -589,12 +589,12 @@ static JSBool
js_conio_loadfont(JSContext *cx, uintN argc, jsval *arglist)
{
jsval *argv=JS_ARGV(cx, arglist);
char * str;
char * str = NULL;
jsrefcount rc;
if(argc==1) {
JSVALUE_TO_MSTRING(cx, argv[0], str, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, str);
if(str != NULL) {
rc=JS_SUSPENDREQUEST(cx);
JS_SET_RVAL(cx, arglist,INT_TO_JSVAL(loadfont(str)));
......@@ -611,12 +611,12 @@ static JSBool
js_conio_settitle(JSContext *cx, uintN argc, jsval *arglist)
{
jsval *argv=JS_ARGV(cx, arglist);
char * str;
char * str = NULL;
jsrefcount rc;
if(argc==1) {
JSVALUE_TO_MSTRING(cx, argv[0], str, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, str);
if(str != NULL) {
rc=JS_SUSPENDREQUEST(cx);
settitle(str);
......@@ -634,12 +634,12 @@ static JSBool
js_conio_setname(JSContext *cx, uintN argc, jsval *arglist)
{
jsval *argv=JS_ARGV(cx, arglist);
char * str;
char * str = NULL;
jsrefcount rc;
if(argc==1) {
JSVALUE_TO_MSTRING(cx, argv[0], str, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, str);
if(str != NULL) {
rc=JS_SUSPENDREQUEST(cx);
setname(str);
......@@ -657,12 +657,12 @@ static JSBool
js_conio_cputs(JSContext *cx, uintN argc, jsval *arglist)
{
jsval *argv=JS_ARGV(cx, arglist);
char * str;
char * str = NULL;
jsrefcount rc;
if(argc==1) {
JSVALUE_TO_MSTRING(cx, argv[0], str, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, str);
if(str != NULL) {
rc=JS_SUSPENDREQUEST(cx);
JS_SET_RVAL(cx, arglist,INT_TO_JSVAL(cputs(str)));
......@@ -716,13 +716,13 @@ static JSBool
js_conio_getpass(JSContext *cx, uintN argc, jsval *arglist)
{
jsval *argv=JS_ARGV(cx, arglist);
char * str;
char * str = NULL;
char * pwd;
jsrefcount rc;
if(argc==1) {
JSVALUE_TO_MSTRING(cx, argv[0], str, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, str);
if(str != NULL) {
rc=JS_SUSPENDREQUEST(cx);
pwd=getpass(str);
......@@ -1185,7 +1185,7 @@ static JSBool js_conio_resolve(JSContext *cx, JSObject *obj, jsid id)
JS_IdToValue(cx, id, &idval);
if(JSVAL_IS_STRING(idval)) {
JSSTRING_TO_MSTRING(cx, JSVAL_TO_STRING(idval), name, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, name);
if(name==NULL)
return JS_FALSE;
}
......
......@@ -1958,7 +1958,7 @@ static JSBool js_console_resolve(JSContext *cx, JSObject *obj, jsid id)
JS_IdToValue(cx, id, &idval);
if(JSVAL_IS_STRING(idval)) {
JSSTRING_TO_MSTRING(cx, JSVAL_TO_STRING(idval), name, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, name);
}
}
......
......@@ -88,7 +88,7 @@ js_set_key(JSContext *cx, uintN argc, jsval *arglist)
JSObject *obj;
jsval *argv;
size_t len;
char* key;
char* key = NULL;
int status;
jsrefcount rc;
......@@ -98,7 +98,7 @@ js_set_key(JSContext *cx, uintN argc, jsval *arglist)
argv = JS_ARGV(cx, arglist);
JSVALUE_TO_MSTRING(cx, argv[0], key, &len);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, key);
obj = JS_THIS_OBJECT(cx, arglist);
if ((p=(struct private_data *)JS_GetPrivate(cx,obj))==NULL) {
......@@ -127,7 +127,7 @@ js_derive_key(JSContext *cx, uintN argc, jsval *arglist)
JSObject *obj;
jsval *argv;
size_t len;
char* key;
char* key = NULL;
int status;
jsrefcount rc;
......@@ -137,7 +137,7 @@ js_derive_key(JSContext *cx, uintN argc, jsval *arglist)
argv = JS_ARGV(cx, arglist);
JSVALUE_TO_MSTRING(cx, argv[0], key, &len);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, key);
if (len < 8 || len > CRYPT_MAX_HASHSIZE) {
free(key);
......@@ -172,7 +172,7 @@ js_do_encrption(JSContext *cx, uintN argc, jsval *arglist, int encrypt)
JSObject *obj;
jsval *argv;
size_t len;
char *cipherText;
char *cipherText = NULL;
int status;
jsrefcount rc;
JSString* str;
......@@ -189,7 +189,7 @@ js_do_encrption(JSContext *cx, uintN argc, jsval *arglist, int encrypt)
}
JSVALUE_TO_MSTRING(cx, argv[0], cipherText, &len);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cipherText);
rc = JS_SUSPENDREQUEST(cx);
if (encrypt)
......@@ -306,11 +306,11 @@ static JSBool
js_cryptcon_attrstr_set(JSContext *cx, jsval *vp, CRYPT_CONTEXT ctx, CRYPT_ATTRIBUTE_TYPE type)
{
int status;
char *val;
char *val = NULL;
size_t len;
JSVALUE_TO_MSTRING(cx, *vp, val, &len);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, val);
status = cryptSetAttributeString(ctx, type, val, len);
if (cryptStatusError(status)) {
......@@ -518,7 +518,7 @@ static JSBool js_cryptcon_resolve(JSContext *cx, JSObject *obj, jsid id)
JS_IdToValue(cx, id, &idval);
if(JSVAL_IS_STRING(idval)) {
JSSTRING_TO_MSTRING(cx, JSVAL_TO_STRING(idval), name, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, name);
}
}
......
......@@ -1008,7 +1008,7 @@ js_iniRemoveKey(JSContext *cx, uintN argc, jsval *arglist)
if(argc && argv[0]!=JSVAL_VOID && argv[0]!=JSVAL_NULL)
JSVALUE_TO_MSTRING(cx, argv[0], section, NULL);
JSVALUE_TO_MSTRING(cx, argv[1], key, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, key);
if(key==NULL) {
JS_ReportError(cx, "Invalid NULL key specified");
FREE_AND_NULL(section);
......@@ -1057,7 +1057,7 @@ js_iniRemoveSection(JSContext *cx, uintN argc, jsval *arglist)
if(argc && argv[0]!=JSVAL_VOID && argv[0]!=JSVAL_NULL) {
JSVALUE_TO_MSTRING(cx, argv[0], section, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, section);
}
rc=JS_SUSPENDREQUEST(cx);
......@@ -1103,7 +1103,7 @@ js_iniGetSections(JSContext *cx, uintN argc, jsval *arglist)
if(argc) {
JSVALUE_TO_MSTRING(cx, argv[0], prefix, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, prefix);
}
array = JS_NewArrayObject(cx, 0, NULL);
......@@ -1151,7 +1151,7 @@ js_iniGetKeys(JSContext *cx, uintN argc, jsval *arglist)
if(argc && argv[0]!=JSVAL_VOID && argv[0]!=JSVAL_NULL) {
JSVALUE_TO_MSTRING(cx, argv[0], section, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, section);
}
array = JS_NewArrayObject(cx, 0, NULL);
......@@ -1197,7 +1197,7 @@ js_iniGetObject(JSContext *cx, uintN argc, jsval *arglist)
if(argc>0 && argv[0]!=JSVAL_VOID && argv[0]!=JSVAL_NULL) {
JSVALUE_TO_MSTRING(cx, argv[0], section, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, section);
}
rc=JS_SUSPENDREQUEST(cx);
......@@ -1339,7 +1339,7 @@ js_iniGetAllObjects(JSContext *cx, uintN argc, jsval *arglist)
if(argc)
JSVALUE_TO_MSTRING(cx, argv[0], name, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, name);
if(name == NULL) {
JS_ReportError(cx, "Invalid NULL name property");
return JS_FALSE;
......@@ -1484,7 +1484,7 @@ js_iniSetAllObjects(JSContext *cx, uintN argc, jsval *arglist)
if(argc>1)
JSVALUE_TO_MSTRING(cx, argv[1], name, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, name);
if(name==NULL) {
JS_ReportError(cx, "Invalid NULL name property");
return JS_FALSE;
......@@ -1568,7 +1568,7 @@ js_raw_write(JSContext *cx, uintN argc, jsval *arglist)
{
JSObject *obj=JS_THIS_OBJECT(cx, arglist);
jsval *argv=JS_ARGV(cx, arglist);
char* cp;
char* cp = NULL;
size_t len; /* string length */
JSString* str;
private_t* p;
......@@ -1588,7 +1588,7 @@ js_raw_write(JSContext *cx, uintN argc, jsval *arglist)
return(JS_FALSE);
JSSTRING_TO_MSTRING(cx, str, cp, &len);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL)
return JS_TRUE;
......@@ -1612,7 +1612,7 @@ js_write(JSContext *cx, uintN argc, jsval *arglist)
{
JSObject *obj=JS_THIS_OBJECT(cx, arglist);
jsval *argv=JS_ARGV(cx, arglist);
char* cp;
char* cp = NULL;
char* uubuf=NULL;
size_t len; /* string length */
int decoded_len;
......@@ -1636,7 +1636,7 @@ js_write(JSContext *cx, uintN argc, jsval *arglist)
return(JS_FALSE);
JSSTRING_TO_MSTRING(cx, str, cp, &len);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL)
return JS_TRUE;
......@@ -1730,7 +1730,7 @@ js_writeln_internal(JSContext *cx, JSObject *obj, jsval *arg, jsval *rval)
return(JS_FALSE);
}
JSSTRING_TO_MSTRING(cx, str, cp, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL)
cp=(char *)cp_def;
}
......
This diff is collapsed.
......@@ -292,7 +292,7 @@ static JSBool
js_eval(JSContext *parent_cx, uintN argc, jsval *arglist)
{
jsval *argv=JS_ARGV(parent_cx, arglist);
char* buf;
char* buf = NULL;
size_t buflen;
JSString* str;
JSObject* script;
......@@ -308,7 +308,7 @@ js_eval(JSContext *parent_cx, uintN argc, jsval *arglist)
if((str=JS_ValueToString(parent_cx, argv[0]))==NULL)
return(JS_FALSE);
JSSTRING_TO_MSTRING(parent_cx, str, buf, &buflen);
HANDLE_PENDING(parent_cx);
HANDLE_PENDING(parent_cx, buf);
if(buf==NULL)
return(JS_TRUE);
......@@ -376,10 +376,10 @@ static JSBool
js_report_error(JSContext *cx, uintN argc, jsval *arglist)
{
jsval *argv=JS_ARGV(cx, arglist);
char *p;
char *p = NULL;
JSVALUE_TO_MSTRING(cx, argv[0], p, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, p);
if(p==NULL)
JS_ReportError(cx,"NULL");
else {
......@@ -404,7 +404,7 @@ js_on_exit(JSContext *cx, uintN argc, jsval *arglist)
global_private_t* pd;
str_list_t list;
str_list_t oldlist;
char *p;
char *p = NULL;
JS_SET_RVAL(cx, arglist, JSVAL_VOID);
......@@ -424,7 +424,7 @@ js_on_exit(JSContext *cx, uintN argc, jsval *arglist)
}
JSVALUE_TO_MSTRING(cx, argv[0], p, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, p);
if(!p)
return JS_TRUE;
oldlist=list;
......@@ -531,7 +531,7 @@ static JSBool js_internal_resolve(JSContext *cx, JSObject *obj, jsid id)
JS_IdToValue(cx, id, &idval);
if(JSVAL_IS_STRING(idval)) {
JSSTRING_TO_MSTRING(cx, JSVAL_TO_STRING(idval), name, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, name);
}
}
......
......@@ -156,7 +156,7 @@ static BOOL parse_recipient_object(JSContext* cx, private_t* p, JSObject* hdr, s
if(JS_GetProperty(cx, hdr, "to", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"to\" string in recipient object");
return(FALSE);
......@@ -182,7 +182,7 @@ static BOOL parse_recipient_object(JSContext* cx, private_t* p, JSObject* hdr, s
if(JS_GetProperty(cx, hdr, "to_ext", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"to_ext\" string in recipient object");
return(FALSE);
......@@ -198,7 +198,7 @@ static BOOL parse_recipient_object(JSContext* cx, private_t* p, JSObject* hdr, s
if(JS_GetProperty(cx, hdr, "to_org", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"to_org\" string in recipient object");
return(FALSE);
......@@ -218,7 +218,7 @@ static BOOL parse_recipient_object(JSContext* cx, private_t* p, JSObject* hdr, s
if(JS_GetProperty(cx, hdr, "to_net_addr", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"to_net_addr\" string in recipient object");
return(FALSE);
......@@ -305,7 +305,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
/* Required Header Fields */
if(JS_GetProperty(cx, hdr, "subject", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"subject\" string in header object");
goto err;
......@@ -321,7 +321,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
}
if(JS_GetProperty(cx, hdr, "from", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"from\" string in header object");
goto err;
......@@ -343,7 +343,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
/* Optional Header Fields */
if(JS_GetProperty(cx, hdr, "from_ext", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"from_ext\" string in header object");
goto err;
......@@ -358,7 +358,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
if(JS_GetProperty(cx, hdr, "from_org", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"from_org\" string in header object");
goto err;
......@@ -378,7 +378,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
if(JS_GetProperty(cx, hdr, "from_net_addr", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"from_net_addr\" string in header object");
goto err;
......@@ -410,7 +410,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
if(JS_GetProperty(cx, hdr, "from_ip_addr", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"from_ip_addr\" string in header object");
goto err;
......@@ -423,7 +423,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
if(JS_GetProperty(cx, hdr, "from_host_name", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"from_host_name\" string in header object");
goto err;
......@@ -436,7 +436,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
if(JS_GetProperty(cx, hdr, "from_protocol", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"from_protocol\" string in header object");
goto err;
......@@ -449,7 +449,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
if(JS_GetProperty(cx, hdr, "from_port", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"from_port\" string in header object");
goto err;
......@@ -462,7 +462,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
if(JS_GetProperty(cx, hdr, "sender_userid", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"sender_userid\" string in header object");
goto err;
......@@ -475,7 +475,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
if(JS_GetProperty(cx, hdr, "sender_server", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"sender_server\" string in header object");
goto err;
......@@ -488,7 +488,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
if(JS_GetProperty(cx, hdr, "sender_time", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"sender_time\" string in header object");
goto err;
......@@ -501,7 +501,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
if(JS_GetProperty(cx, hdr, "replyto", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"replyto\" string in header object");
goto err;
......@@ -514,7 +514,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
if(JS_GetProperty(cx, hdr, "replyto_ext", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"replyto_ext\" string in header object");
goto err;
......@@ -527,7 +527,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
if(JS_GetProperty(cx, hdr, "replyto_org", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"replyto_org\" string in header object");
goto err;
......@@ -546,7 +546,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
}
if(JS_GetProperty(cx, hdr, "replyto_net_addr", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {
JS_ReportError(cx, "Invalid \"replyto_net_addr\" string in header object");
goto err;
......@@ -576,7 +576,7 @@ static BOOL parse_header_object(JSContext* cx, private_t* p, JSObject* hdr, smbm
/* RFC822 headers */
if(JS_GetProperty(cx, hdr, "id", &val) && !JSVAL_NULL_OR_VOID(val)) {
JSVALUE_TO_RASTRING(cx, val, cp, &cp_sz, NULL);
HANDLE_PENDING(cx);
HANDLE_PENDING(cx, cp);
if(cp==NULL) {