static void
-releaseDecompStruct(struct structDecomp const structDecomp,
+releaseDecompStruct(struct structDecomp const *_structDecomp,
bool const oldstyleMemMgmt) {
+ struct structDecomp const structDecomp = *_structDecomp;
unsigned int i;
for (i = 0; i < structDecomp.mbrCnt; ++i) {
releaseDecomposition(structDecomp.mbrArray[i].decompTreeP,
releaseDecompArray(decompRootP->store.Tarray, oldstyleMemMgmt);
break;
case '{':
- releaseDecompStruct(decompRootP->store.Tstruct, oldstyleMemMgmt);
+ releaseDecompStruct(&decompRootP->store.Tstruct, oldstyleMemMgmt);
break;
}
}
static void
validateArraySize(xmlrpc_env * const envP,
const xmlrpc_value * const arrayP,
- struct arrayDecomp const arrayDecomp) {
+ struct arrayDecomp const *_arrayDecomp) {
+ struct arrayDecomp const arrayDecomp = *_arrayDecomp;
unsigned int size;
size = xmlrpc_array_size(envP, arrayP);
static void
parsearray(xmlrpc_env * const envP,
const xmlrpc_value * const arrayP,
- struct arrayDecomp const arrayDecomp,
+ struct arrayDecomp const *_arrayDecomp,
bool const oldstyleMemMgmt) {
- validateArraySize(envP, arrayP, arrayDecomp);
+ struct arrayDecomp const arrayDecomp = *_arrayDecomp;
+
+ validateArraySize(envP, arrayP, &arrayDecomp);
if (!envP->fault_occurred) {
unsigned int doneCnt;
static void
parsestruct(xmlrpc_env * const envP,
xmlrpc_value * const structP,
- struct structDecomp const structDecomp,
+ struct structDecomp const *_structDecomp,
bool const oldstyleMemMgmt) {
+ struct structDecomp const structDecomp = *_structDecomp;
unsigned int doneCount;
doneCount = 0; /* No members done yet */
"%s, but the '(...)' specifier requires type ARRAY",
xmlrpc_type_name(xmlrpc_value_type(valueP)));
else
- parsearray(envP, valueP, decompRootP->store.Tarray,
+ parsearray(envP, valueP, &decompRootP->store.Tarray,
oldstyleMemMgmt);
break;
"%s, but the '{...}' specifier requires type STRUCT",
xmlrpc_type_name(xmlrpc_value_type(valueP)));
else
- parsestruct(envP, valueP, decompRootP->store.Tstruct,
+ parsestruct(envP, valueP, &decompRootP->store.Tstruct,
oldstyleMemMgmt);
break;
size_t input_size, output_size;
int code;
char *message;
+ char *err = NULL;
/* Error-handling preconditions. */
xmlrpc_env_init(&env);
}
if (!type || !xmlrpc_strneq(type, "text/xml", strlen("text/xml"))) {
char *template = "Expected content type: \"text/xml\", received: \"%s\"";
- size_t err_len = strlen(template) + strlen(type) + 1;
- char *err = malloc(err_len);
+ size_t err_len = strlen(template) + (type ? strlen(type) : 0) + 1;
- (void)snprintf(err, err_len, template, type);
+ err = malloc(err_len);
+
+ (void)snprintf(err, err_len, template, (type ? type : ""));
code = 400; message = "Bad Request";
XMLRPC_FAIL(&env, XMLRPC_INTERNAL_ERROR, err);
- free(err);
}
if (!length_str) {
code = 411; message = "Length Required";
send_xml(output_data, output_size);
cleanup:
+ if (err)
+ free(err);
if (input)
xmlrpc_mem_block_free(input);
if (output)