xschema = xmlSchemaParse(ctx);
if (xschema == NULL) {
_LOGE("xmlSchemaParse() Failed\n");
+ xmlSchemaFreeParserCtxt(ctx);
return PMINFO_R_ERROR;
}
vctx = xmlSchemaNewValidCtxt(xschema);
if (vctx == NULL) {
_LOGE("xmlSchemaNewValidCtxt() Failed\n");
+ xmlSchemaFree(xschema);
+ xmlSchemaFreeParserCtxt(ctx);
return PMINFO_R_ERROR;
}
xmlSchemaSetValidErrors(vctx, (xmlSchemaValidityErrorFunc) fprintf, (xmlSchemaValidityWarningFunc) fprintf, stderr);
ret = xmlSchemaValidateFile(vctx, manifest, 0);
if (ret == -1) {
_LOGE("xmlSchemaValidateFile() failed\n");
- return PMINFO_R_ERROR;
+ ret = PMINFO_R_ERROR;
} else if (ret == 0) {
_LOGD("Manifest is Valid\n");
- return PMINFO_R_OK;
+ ret = PMINFO_R_OK;
} else {
_LOGE("Manifest Validation Failed with error code %d\n", ret);
- return PMINFO_R_ERROR;
+ ret = PMINFO_R_ERROR;
}
- return PMINFO_R_OK;
+ xmlSchemaFreeValidCtxt(vctx);
+ xmlSchemaFree(xschema);
+ xmlSchemaFreeParserCtxt(ctx);
+ return ret;
}