• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ oscap_free函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中oscap_free函数的典型用法代码示例。如果您正苦于以下问题:C++ oscap_free函数的具体用法?C++ oscap_free怎么用?C++ oscap_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了oscap_free函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: _oval_test_parse_tag

static int _oval_test_parse_tag(xmlTextReaderPtr reader, struct oval_parser_context *context, void *user)
{
	struct oval_test *test = (struct oval_test *)user;
	char *tagname = (char *)xmlTextReaderLocalName(reader);
	int return_code = 0;
	if ((strcmp(tagname, "notes") == 0)) {
		return_code = oval_parser_parse_tag(reader, context, &_oval_test_parse_notes, test);
	} else if ((strcmp(tagname, "object") == 0)) {
		char *object_ref = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "object_ref");
		if (object_ref != NULL) {
			struct oval_definition_model *model = context->definition_model;
			struct oval_object *object = oval_definition_model_get_new_object(model, object_ref);
			oscap_free(object_ref);
			object_ref = NULL;
			oval_test_set_object(test, object);
		}
	} else if ((strcmp(tagname, "state") == 0)) {
		char *state_ref = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "state_ref");
		if (state_ref != NULL) {
			struct oval_definition_model *model = context->definition_model;
			struct oval_state *state = oval_definition_model_get_new_state(model, state_ref);
			oval_test_add_state(test, state);
			oscap_free(state_ref);
			state_ref = NULL;
		}
	} else {
		oscap_dlprintf(DBG_W, "Skipping tag <%s>.\n", tagname);
		return_code = oval_parser_skip_tag(reader, context);
	}

	oscap_free(tagname);
	return return_code;

}
开发者ID:savon-noir,项目名称:openscap,代码行数:34,代码来源:oval_test.c


示例2: ds_sds_compose_component_add_script_content

static inline int ds_sds_compose_component_add_script_content(xmlNode *component, const char *filepath)
{
	FILE* f = fopen(filepath, "r");
	if (!f) {
		oscap_seterr(OSCAP_EFAMILY_GLIBC, "Can't read plain text from file '%s'.", filepath);
		return -1;
	}

	fseek(f, 0, SEEK_END);
	long int length = ftell(f);
	fseek(f, 0, SEEK_SET);
	if (length >= 0) {
		char* buffer = oscap_alloc((length + 1) * sizeof(char));
		if (fread(buffer, length, 1, f) != 1) {
			oscap_seterr(OSCAP_EFAMILY_GLIBC, "Error while reading from file '%s'.", filepath);
			fclose(f);
			oscap_free(buffer);
			return -1;
		}
		fclose(f);
		buffer[length] = '\0';
		xmlNsPtr local_ns = xmlNewNs(component, BAD_CAST sce_xccdf_ns_uri, BAD_CAST "oscap-sce-xccdf-stream");
		xmlNewTextChild(component, local_ns, BAD_CAST "script", BAD_CAST buffer);
		oscap_free(buffer);
		return 0;
	} else {
		oscap_seterr(OSCAP_EFAMILY_GLIBC, "No data read from file '%s'.", filepath);
		fclose(f);
		return -1;
	}
}
开发者ID:radzy,项目名称:openscap,代码行数:31,代码来源:sds.c


示例3: probe_main

int probe_main (probe_ctx *ctx, void *arg)
{
        SEXP_t *object;
        struct runlevel_req request_st;
        struct runlevel_rep *reply_st = NULL;

        object = probe_ctx_getobject(ctx);

	request_st.service_name_ent = probe_obj_getent(object, "service_name", 1);
	if (request_st.service_name_ent == NULL) {
		dI("%s: element not found", "service_name");

		return PROBE_ENOELM;
	}

	request_st.runlevel_ent = probe_obj_getent(object, "runlevel", 1);
	if (request_st.runlevel_ent == NULL) {
		SEXP_free(request_st.service_name_ent);
		dI("%s: element not found", "runlevel");

		return PROBE_ENOELM;
	}

	if (get_runlevel(&request_st, &reply_st) == -1) {
		SEXP_t *msg;

		msg = probe_msg_creat(OVAL_MESSAGE_LEVEL_ERROR, "get_runlevel failed.");
		probe_cobj_add_msg(probe_ctx_getresult(ctx), msg);
		SEXP_free(msg);
		probe_cobj_set_flag(probe_ctx_getresult(ctx), SYSCHAR_FLAG_ERROR);
	} else {
		struct runlevel_rep *next_rep;
		SEXP_t *item;

		while (reply_st != NULL) {
			dI("get_runlevel: [0]=\"%s\", [1]=\"%s\", [2]=\"%d\", [3]=\"%d\"",
			   reply_st->service_name, reply_st->runlevel, reply_st->start, reply_st->kill);

                        item = probe_item_create(OVAL_UNIX_RUNLEVEL, NULL,
                                                 "service_name", OVAL_DATATYPE_STRING,  reply_st->service_name,
                                                 "runlevel",     OVAL_DATATYPE_STRING,  reply_st->runlevel,
                                                 "start",        OVAL_DATATYPE_BOOLEAN, reply_st->start,
                                                 "kill",         OVAL_DATATYPE_BOOLEAN, reply_st->kill,
                                                 NULL);

                        probe_item_collect(ctx, item);

			next_rep = reply_st->next;
			oscap_free(reply_st->service_name);
			oscap_free(reply_st->runlevel);
			oscap_free(reply_st);
			reply_st = next_rep;
		}
        }

        SEXP_free(request_st.runlevel_ent);
        SEXP_free(request_st.service_name_ent);

	return 0;
}
开发者ID:nevion,项目名称:openscap,代码行数:60,代码来源:runlevel.c


示例4: oval_definition_model_free

void oval_definition_model_free(struct oval_definition_model *model)
{
	__attribute__nonnull__(model);

	oval_string_map_free(model->definition_map, (oscap_destruct_func) oval_definition_free);
	oval_string_map_free(model->object_map, (oscap_destruct_func) oval_object_free);
	oval_string_map_free(model->state_map, (oscap_destruct_func) oval_state_free);
	oval_string_map_free(model->test_map, (oscap_destruct_func) oval_test_free);
	oval_string_map_free(model->variable_map, (oscap_destruct_func) oval_variable_free);
	if (model->vardef_map != NULL)
		oval_string_map_free(model->vardef_map, (oscap_destruct_func) oval_string_map_free0);
	if (model->bound_variable_models)
		oval_collection_free_items(model->bound_variable_models,
					   (oscap_destruct_func) oval_variable_model_free);

        if (model->schema != NULL)
            oscap_free(model->schema);

	model->definition_map = NULL;
	model->object_map = NULL;
	model->state_map = NULL;
	model->test_map = NULL;
	model->variable_map = NULL;
        model->schema = NULL;

	oval_generator_free(model->generator);

	oscap_free(model);
}
开发者ID:galaris,项目名称:openscap,代码行数:29,代码来源:oval_defModel.c


示例5: _oval_affected_parse_tag

static int _oval_affected_parse_tag(xmlTextReaderPtr reader, struct oval_parser_context *context, void *user)
{
	struct oval_affected *affected = (struct oval_affected *)user;
	int return_code;
	xmlChar *tagname = xmlTextReaderLocalName(reader);
	//xmlChar *namespace = xmlTextReaderNamespaceUri(reader);

	if (strcmp((char *)tagname, "platform") == 0) {
		char *platform = NULL;
		return_code = oscap_parser_text_value(reader, &oscap_text_consumer, &platform);
		if (platform != NULL) {
			oval_affected_add_platform(affected, platform);
			oscap_free(platform);
		}
	} else if (strcmp((char *)tagname, "product") == 0) {
		char *product = NULL;
		return_code = oscap_parser_text_value(reader, &oscap_text_consumer, &product);
		if (product != NULL) {
			oval_affected_add_product(affected, product);
			oscap_free(product);
		}
	} else {
		dI("Skipping tag: %s", tagname);
		return_code = oval_parser_skip_tag(reader, context);
	}
	oscap_free(tagname);
	return return_code;
}
开发者ID:GautamSatish,项目名称:openscap,代码行数:28,代码来源:oval_affected.c


示例6: xccdf_ident_free

void xccdf_ident_free(struct xccdf_ident *ident)
{
	if (ident) {
		oscap_free(ident->id);
		oscap_free(ident->system);
		oscap_free(ident);
	}
}
开发者ID:isimluk,项目名称:openscap,代码行数:8,代码来源:rule.c


示例7: xccdf_profile_note_free

void xccdf_profile_note_free(struct xccdf_profile_note *note)
{
	if (note) {
		oscap_free(note->reftag);
		oscap_text_free(note->text);
		oscap_free(note);
	}
}
开发者ID:isimluk,项目名称:openscap,代码行数:8,代码来源:rule.c


示例8: xccdf_check_content_ref_free

void xccdf_check_content_ref_free(struct xccdf_check_content_ref *ref)
{
	if (ref) {
		oscap_free(ref->name);
		oscap_free(ref->href);
		oscap_free(ref);
	}
}
开发者ID:isimluk,项目名称:openscap,代码行数:8,代码来源:rule.c


示例9: rds_asset_index_free

void rds_asset_index_free(struct rds_asset_index *s)
{
	if (s != NULL) {
		oscap_list_free0(s->reports);
		oscap_free(s->id);
		oscap_free(s);
	}
}
开发者ID:GautamSatish,项目名称:openscap,代码行数:8,代码来源:rds_asset_index.c


示例10: oval_value_free

void oval_value_free(struct oval_value *value)
{
	if (value) {
		oscap_free(value->text);
		value->text = NULL;
		oscap_free(value);
	}
}
开发者ID:GautamSatish,项目名称:openscap,代码行数:8,代码来源:oval_value.c


示例11: xccdf_fixtext_free

void xccdf_fixtext_free(struct xccdf_fixtext *item)
{
	if (item) {
		oscap_text_free(item->text);
		oscap_free(item->fixref);
		oscap_free(item);
	}
}
开发者ID:isimluk,项目名称:openscap,代码行数:8,代码来源:rule.c


示例12: xccdf_check_export_free

void xccdf_check_export_free(struct xccdf_check_export *item)
{
	if (item) {
		oscap_free(item->name);
		oscap_free(item->value);
		oscap_free(item);
	}
}
开发者ID:isimluk,项目名称:openscap,代码行数:8,代码来源:rule.c


示例13: xccdf_check_import_free

void xccdf_check_import_free(struct xccdf_check_import *item)
{
	if (item) {
		oscap_free(item->name);
		oscap_free(item->xpath);
		oscap_free(item->content);
		oscap_free(item);
	}
}
开发者ID:isimluk,项目名称:openscap,代码行数:9,代码来源:rule.c


示例14: assume_d

static SEXP_t *oval_probe_cmd_obj_eval(SEXP_t *sexp, void *arg)
{
	char *id_str;
	struct oval_definition_model *defs;
	struct oval_object  *obj;
	struct oval_syschar *res;
	oval_pext_t *pext = (oval_pext_t *) arg;
	SEXP_t *ret, *ret_code;
	int r;

        assume_d (sexp != NULL, NULL);
        assume_d (arg  != NULL, NULL);

	if (!SEXP_stringp(sexp)) {
		oscap_dlprintf(DBG_E, "Invalid argument: type=%s.\n", SEXP_strtype(sexp));
		return (NULL);
	}

	id_str = SEXP_string_cstr(sexp);
	defs   = oval_syschar_model_get_definition_model(*(pext->model));
	obj    = oval_definition_model_get_object(defs, id_str);
	ret    = SEXP_list_new (sexp, NULL);

	oscap_dlprintf(DBG_I, "Get_object: %s.\n", id_str);

	if (obj == NULL) {
		oscap_dlprintf(DBG_E, "Can't find obj: id=%s.\n", id_str);
		oscap_free(id_str);
                SEXP_free(ret);

		return (NULL);
	}

	oscap_clearerr();
	r = oval_probe_query_object(pext->sess_ptr, obj, OVAL_PDFLAG_NOREPLY|OVAL_PDFLAG_SLAVE, &res);
	if (r < 0)
		ret_code = SEXP_number_newu((unsigned int) SYSCHAR_FLAG_COMPLETE);
	else
		ret_code = SEXP_number_newu((unsigned int) oval_syschar_get_flag(res));

	SEXP_list_add(ret, ret_code);
	SEXP_free(ret_code);

	if (oscap_err()) {
		oscap_dlprintf(DBG_E, "Failed: id: %s, err: %d, %s.\n",
			       id_str, oscap_err_family(), oscap_err_desc());
		oscap_clearerr();
		oscap_free(id_str);
		SEXP_free(ret);

		return (NULL);
	}

	oscap_free(id_str);

	return (ret);
}
开发者ID:linearregression,项目名称:openscap,代码行数:57,代码来源:oval_probe_ext.c


示例15: oval_message_free

void oval_message_free(struct oval_message *message)
{
	__attribute__nonnull__(message);

	if (message->text != NULL)
		oscap_free(message->text);

	message->text = NULL;
	oscap_free(message);
}
开发者ID:GovReady,项目名称:openscap,代码行数:10,代码来源:oval_message.c


示例16: xccdf_fix_free

void xccdf_fix_free(struct xccdf_fix *item)
{
	if (item) {
		oscap_free(item->id);
		oscap_free(item->system);
		oscap_free(item->platform);
		oscap_free(item->content);
		oscap_free(item);
	}
}
开发者ID:isimluk,项目名称:openscap,代码行数:10,代码来源:rule.c


示例17: oval_test_parse_tag

int oval_test_parse_tag(xmlTextReaderPtr reader, struct oval_parser_context *context, void *usr)
{
	int ret = 0;
	char *comm = NULL;
	char *version = NULL;
	struct oval_definition_model *model = context->definition_model;

	char *id = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "id");
	struct oval_test *test = oval_definition_model_get_new_test(model, id);

	oval_subtype_t subtype = oval_subtype_parse(reader);
        if ( subtype == OVAL_SUBTYPE_UNKNOWN) {
		oscap_seterr(OSCAP_EFAMILY_OVAL, "Unknown test type %s.", id);
		ret = -1;
		goto cleanup;
        }
	oval_test_set_subtype(test, subtype);

	oval_operator_t ste_operator = oval_operator_parse(reader, "state_operator", OVAL_OPERATOR_AND);
	oval_test_set_state_operator(test, ste_operator);

	oval_check_t check = oval_check_parse(reader, "check", OVAL_CHECK_UNKNOWN);
	if (check == OVAL_CHECK_NONE_EXIST) {
		dW("The 'none exist' CheckEnumeration value has been deprecated. "
		   "Converted to check='none satisfy' and check_existence='none exist'.\n");
		oval_test_set_check(test, OVAL_CHECK_NONE_SATISFY);
		oval_test_set_existence(test, OVAL_NONE_EXIST);
	} else {
		oval_existence_t existence;

		oval_test_set_check(test, check);
		existence = oval_existence_parse(reader, "check_existence", OVAL_AT_LEAST_ONE_EXISTS);
		oval_test_set_existence(test, existence);
	}

	comm = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "comment");
	if (comm != NULL) {
		oval_test_set_comment(test, comm);
	}

	int deprecated = oval_parser_boolean_attribute(reader, "deprecated", 0);
	oval_test_set_deprecated(test, deprecated);

	version = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "version");
	oval_test_set_version(test, atoi(version));


	ret = oval_parser_parse_tag(reader, context, &_oval_test_parse_tag, test);

cleanup:
	oscap_free(version);
	oscap_free(comm);
	oscap_free(id);
	return ret;
}
开发者ID:GovReady,项目名称:openscap,代码行数:55,代码来源:oval_test.c


示例18: probe_ent_cmp_version

oval_result_t probe_ent_cmp_version(SEXP_t * val1, SEXP_t * val2, oval_operation_t op)
{
	const char *state_version = SEXP_string_cstr(val1);
	const char *sys_version = SEXP_string_cstr(val2);

	oval_result_t result = oval_versiontype_cmp(state_version, sys_version, op);

	oscap_free(state_version);
	oscap_free(sys_version);
	return result;
}
开发者ID:swizzley,项目名称:openscap,代码行数:11,代码来源:entcmp.c


示例19: oval_agent_destroy_session

void oval_agent_destroy_session(oval_agent_session_t * ag_sess) {
	if (ag_sess != NULL) {
		oscap_free(ag_sess->product_name);
#if defined(OVAL_PROBES_ENABLED)
		oval_probe_session_destroy(ag_sess->psess);
		oval_results_model_free(ag_sess->res_model);
#endif
		oval_syschar_model_free(ag_sess->sys_model);
	        oscap_free(ag_sess->filename);
		oscap_free(ag_sess);
	}
}
开发者ID:msmeissn,项目名称:openscap,代码行数:12,代码来源:oval_agent.c


示例20: probe_ent_cmp_evr

oval_result_t probe_ent_cmp_evr(SEXP_t * val1, SEXP_t * val2, oval_operation_t op)
{
	oval_result_t result = OVAL_RESULT_ERROR;
	char *s1 = SEXP_string_cstr(val1);
	char *s2 = SEXP_string_cstr(val2);

	result = oval_evr_string_cmp(s1, s2, op);

	oscap_free(s1);
	oscap_free(s2);
	return result;
}
开发者ID:swizzley,项目名称:openscap,代码行数:12,代码来源:entcmp.c



注:本文中的oscap_free函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ oscap_seterr函数代码示例发布时间:2022-05-30
下一篇:
C++ osal_task_sleep函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap