Пример #1
0
Файл: load.c Проект: visy/turha
void xmp_release_module(xmp_context opaque)
{
	struct context_data *ctx = (struct context_data *)opaque;
	struct module_data *m = &ctx->m;
	struct xmp_module *mod = &m->mod;
	int i;

	/* can't test this here, we must call release_module to clean up
	 * load errors
	if (ctx->state < XMP_STATE_LOADED)
		return;
	 */

	if (ctx->state > XMP_STATE_LOADED)
		xmp_end_player(opaque);

	ctx->state = XMP_STATE_UNLOADED;

	D_(D_INFO "Freeing memory");

	release_module_extras(ctx);

	for (i = 0; i < mod->trk; i++)
		free(mod->xxt[i]);
	if (mod->trk > 0)
		free(mod->xxt);

	for (i = 0; i < mod->pat; i++)
		free(mod->xxp[i]);
	if (mod->pat > 0)
		free(mod->xxp);

	for (i = 0; i < mod->ins; i++) {
		free(mod->xxi[i].sub);
		free(mod->xxi[i].extra);
	}
	if (mod->ins > 0)
		free(mod->xxi);

	for (i = 0; i < mod->smp; i++) {
		if (mod->xxs[i].data != NULL)
			free(mod->xxs[i].data - 4);
	}
	if (mod->smp > 0)
		free(mod->xxs);

	if (m->scan_cnt) {
		for (i = 0; i < mod->len; i++)
			free(m->scan_cnt[i]);
		free(m->scan_cnt);
	}

	free(m->comment);

	D_("free dirname/basename");
	free(m->dirname);
	free(m->basename);

}
Пример #2
0
void xmp_release_module(xmp_context opaque)
{
	struct context_data *ctx = (struct context_data *)opaque;
	struct module_data *m = &ctx->m;
	struct xmp_module *mod = &m->mod;
	int i;

	if (ctx->state > XMP_STATE_LOADED)
		xmp_end_player(opaque);

	ctx->state = XMP_STATE_UNLOADED;

	D_(D_INFO "Freeing memory");

	release_module_extras(ctx);

	if (mod->xxt) {
		for (i = 0; i < mod->trk; i++) {
			free(mod->xxt[i]);
		}
		free(mod->xxt);
	}

	if (mod->xxp) {
		for (i = 0; i < mod->pat; i++) {
			free(mod->xxp[i]);
		}
		free(mod->xxp);
	}


	if (mod->xxi) {
		for (i = 0; i < mod->ins; i++) {
			free(mod->xxi[i].sub);
			free(mod->xxi[i].extra);
		}
		free(mod->xxi);
	}

	if (mod->xxs) {
		for (i = 0; i < mod->smp; i++) {
			if (mod->xxs[i].data != NULL)
				free(mod->xxs[i].data - 4);
		}
		free(mod->xxs);
	}

	if (m->scan_cnt) {
		for (i = 0; i < mod->len; i++) {
			free(m->scan_cnt[i]);
		}
		free(m->scan_cnt);
	}

	if (m->comment) {
		free(m->comment);
	}

	D_("free dirname/basename");
	free(m->dirname);
	free(m->basename);
}