Replaced sci_free() with free() - it's OK to free a NULL pointer, so the checking that sci_free() performed is not necessary
svn-id: r38406
This commit is contained in:
parent
b8d2c41cdd
commit
d39d83e525
25 changed files with 84 additions and 103 deletions
|
@ -278,7 +278,7 @@ _free_graphics_input(state_t *s) {
|
|||
s->port = NULL;
|
||||
|
||||
if (s->pics)
|
||||
sci_free(s->pics);
|
||||
free(s->pics);
|
||||
s->pics = NULL;
|
||||
}
|
||||
|
||||
|
@ -415,7 +415,7 @@ create_class_table_sci0(state_t *s) {
|
|||
seeker += getInt16(script->data + seeker + 2);
|
||||
if (seeker <= lastseeker) {
|
||||
sciprintf("Warning: Script version is invalid.\n");
|
||||
sci_free(s->classtable);
|
||||
free(s->classtable);
|
||||
return SCI_ERROR_INVALID_SCRIPT_VERSION;
|
||||
}
|
||||
}
|
||||
|
@ -572,7 +572,7 @@ script_free_vm_memory(state_t *s) {
|
|||
sciprintf("Freeing VM memory\n");
|
||||
s->save_dir_copy_buf = NULL;
|
||||
|
||||
sci_free(s->classtable);
|
||||
free(s->classtable);
|
||||
s->classtable = NULL;
|
||||
|
||||
/* Close all opened file handles */
|
||||
|
@ -580,7 +580,7 @@ script_free_vm_memory(state_t *s) {
|
|||
if (s->file_handles[i])
|
||||
fclose(s->file_handles[i]);
|
||||
|
||||
sci_free(s->file_handles);
|
||||
free(s->file_handles);
|
||||
s->file_handles = NULL;
|
||||
|
||||
/* FIXME: file handles will NOT be closed under DOS. DJGPP generates an
|
||||
|
@ -611,7 +611,7 @@ script_free_breakpoints(state_t *s) {
|
|||
bp = s->bp_list;
|
||||
while (bp) {
|
||||
bp_next = bp->next;
|
||||
if (bp->type == BREAK_SELECTOR) sci_free(bp->data.name);
|
||||
if (bp->type == BREAK_SELECTOR) free(bp->data.name);
|
||||
free(bp);
|
||||
bp = bp_next;
|
||||
}
|
||||
|
@ -708,7 +708,7 @@ game_init(state_t *s) {
|
|||
int
|
||||
game_exit(state_t *s) {
|
||||
if (s->execution_stack) {
|
||||
sci_free(s->execution_stack);
|
||||
free(s->execution_stack);
|
||||
}
|
||||
|
||||
sfx_exit(&s->sound);
|
||||
|
@ -718,7 +718,7 @@ game_exit(state_t *s) {
|
|||
sm_destroy(&s->seg_manager);
|
||||
|
||||
if (s->synonyms_nr) {
|
||||
sci_free(s->synonyms);
|
||||
free(s->synonyms);
|
||||
s->synonyms = NULL;
|
||||
s->synonyms_nr = 0;
|
||||
}
|
||||
|
@ -729,7 +729,7 @@ game_exit(state_t *s) {
|
|||
#warning "Free parser segment here"
|
||||
#endif
|
||||
if (send_calls_allocated) {
|
||||
sci_free(send_calls);
|
||||
free(send_calls);
|
||||
send_calls_allocated = 0;
|
||||
}
|
||||
|
||||
|
@ -741,7 +741,7 @@ game_exit(state_t *s) {
|
|||
|
||||
_free_graphics_input(s);
|
||||
|
||||
sci_free(s->game_name);
|
||||
free(s->game_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ worklist_pop(worklist_t **wlp) {
|
|||
|
||||
if (!wl->used) {
|
||||
*wlp = wl->next;
|
||||
sci_free(wl);
|
||||
free(wl);
|
||||
}
|
||||
|
||||
return retval;
|
||||
|
@ -97,7 +97,7 @@ free_worklist(worklist_t *wl) {
|
|||
if (wl) {
|
||||
if (wl->next)
|
||||
free_worklist(wl->next);
|
||||
sci_free(wl);
|
||||
free(wl);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,7 +235,7 @@ find_all_used_references(state_t *s) {
|
|||
for (i = 1; i < sm->heap_size; i++)
|
||||
if (interfaces[i])
|
||||
interfaces[i]->deallocate_self(interfaces[i]);
|
||||
sci_free(interfaces);
|
||||
free(interfaces);
|
||||
delete nonnormal_map;
|
||||
return normal_map;
|
||||
}
|
||||
|
|
|
@ -902,7 +902,7 @@ script_map_kernel(state_t *s) {
|
|||
|
||||
void
|
||||
free_kfunct_tables(state_t *s) {
|
||||
sci_free(s->kfunct_table);
|
||||
free(s->kfunct_table);
|
||||
s->kfunct_table = NULL;
|
||||
|
||||
}
|
||||
|
|
|
@ -298,7 +298,7 @@ _chdir_savedir(state_t *s) {
|
|||
sciprintf(__FILE__": Can't chdir to savegame dir '%s' or "
|
||||
"create it\n", save_dir);
|
||||
|
||||
sci_free(cwd);
|
||||
free(cwd);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -590,7 +590,7 @@ kCheckFreeSpace(state_t *s, int funct_nr, int argc, reg_t *argv) {
|
|||
|
||||
remove(testpath);
|
||||
|
||||
sci_free(testpath);
|
||||
free(testpath);
|
||||
|
||||
return make_reg(0, !failed);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ kDrawStatus(state_t *s, int funct_nr, int argc, reg_t *argv) {
|
|||
s->status_bar_background = bgcolor;
|
||||
|
||||
if (NULL != s->status_bar_text) {
|
||||
sci_free(s->status_bar_text);
|
||||
free(s->status_bar_text);
|
||||
s->status_bar_text = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -872,7 +872,7 @@ visible_vertices(pf_state_t *s, vertex_t *vert)
|
|||
}
|
||||
}
|
||||
|
||||
sci_free(vert_sorted);
|
||||
free(vert_sorted);
|
||||
|
||||
/* Free tree */
|
||||
aatree_free(tree);
|
||||
|
@ -1252,10 +1252,10 @@ free_polygon(polygon_t *polygon)
|
|||
while (!CLIST_EMPTY(&polygon->vertices)) {
|
||||
vertex_t *vertex = CLIST_FIRST(&polygon->vertices);
|
||||
CLIST_REMOVE(&polygon->vertices, vertex, entries);
|
||||
sci_free(vertex);
|
||||
free(vertex);
|
||||
}
|
||||
|
||||
sci_free(polygon);
|
||||
free(polygon);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1266,10 +1266,10 @@ free_pf_state(pf_state_t *p)
|
|||
*/
|
||||
{
|
||||
if (p->vertex_index)
|
||||
sci_free(p->vertex_index);
|
||||
free(p->vertex_index);
|
||||
|
||||
if (p->vis_matrix)
|
||||
sci_free(p->vis_matrix);
|
||||
free(p->vis_matrix);
|
||||
|
||||
while (!LIST_EMPTY(&p->polygons)) {
|
||||
polygon_t *polygon = LIST_FIRST(&p->polygons);
|
||||
|
@ -1277,7 +1277,7 @@ free_pf_state(pf_state_t *p)
|
|||
free_polygon(polygon);
|
||||
}
|
||||
|
||||
sci_free(p);
|
||||
free(p);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -2559,7 +2559,7 @@ set_debug_mode(struct _state *s, int mode, const char *areas) {
|
|||
(int *) &(s->debug_mode),
|
||||
param);
|
||||
|
||||
sci_free(param);
|
||||
free(param);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -2954,7 +2954,7 @@ int c_bpdel(state_t *s) {
|
|||
/* Delete it */
|
||||
bp_next = bp->next;
|
||||
type = bp->type;
|
||||
if (type == BREAK_SELECTOR) sci_free(bp->data.name);
|
||||
if (type == BREAK_SELECTOR) free(bp->data.name);
|
||||
free(bp);
|
||||
if (bp_prev)
|
||||
bp_prev->next = bp_next;
|
||||
|
|
|
@ -153,7 +153,7 @@ void sm_destroy(seg_manager_t* self) {
|
|||
|
||||
delete self->id_seg_map;
|
||||
|
||||
sci_free(self->heap);
|
||||
free(self->heap);
|
||||
self->heap = NULL;
|
||||
}
|
||||
|
||||
|
@ -285,44 +285,44 @@ _sm_deallocate(seg_manager_t* self, int seg, int recursive) {
|
|||
break;
|
||||
|
||||
case MEM_OBJ_LOCALS:
|
||||
sci_free(mobj->data.locals.locals);
|
||||
free(mobj->data.locals.locals);
|
||||
mobj->data.locals.locals = NULL;
|
||||
break;
|
||||
|
||||
case MEM_OBJ_DYNMEM:
|
||||
if (mobj->data.dynmem.buf)
|
||||
sci_free(mobj->data.dynmem.buf);
|
||||
free(mobj->data.dynmem.buf);
|
||||
mobj->data.dynmem.buf = NULL;
|
||||
break;
|
||||
case MEM_OBJ_SYS_STRINGS:
|
||||
sys_string_free_all(&(mobj->data.sys_strings));
|
||||
break;
|
||||
case MEM_OBJ_STACK:
|
||||
sci_free(mobj->data.stack.entries);
|
||||
free(mobj->data.stack.entries);
|
||||
mobj->data.stack.entries = NULL;
|
||||
break;
|
||||
case MEM_OBJ_LISTS:
|
||||
sci_free(mobj->data.lists.table);
|
||||
free(mobj->data.lists.table);
|
||||
mobj->data.lists.table = NULL;
|
||||
mobj->data.lists.entries_nr = mobj->data.lists.max_entry = 0;
|
||||
break;
|
||||
case MEM_OBJ_NODES:
|
||||
sci_free(mobj->data.nodes.table);
|
||||
free(mobj->data.nodes.table);
|
||||
mobj->data.nodes.table = NULL;
|
||||
mobj->data.nodes.entries_nr = mobj->data.nodes.max_entry = 0;
|
||||
break;
|
||||
case MEM_OBJ_CLONES:
|
||||
sci_free(mobj->data.clones.table);
|
||||
free(mobj->data.clones.table);
|
||||
mobj->data.clones.table = NULL;
|
||||
mobj->data.clones.entries_nr = mobj->data.clones.max_entry = 0;
|
||||
break;
|
||||
case MEM_OBJ_HUNK:
|
||||
sci_free(mobj->data.hunks.table);
|
||||
free(mobj->data.hunks.table);
|
||||
mobj->data.hunks.table = NULL;
|
||||
mobj->data.hunks.entries_nr = mobj->data.hunks.max_entry = 0;
|
||||
break;
|
||||
case MEM_OBJ_RESERVED:
|
||||
sci_free(mobj->data.reserved);
|
||||
free(mobj->data.reserved);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Deallocating segment type %d not supported!\n",
|
||||
|
@ -432,7 +432,7 @@ void
|
|||
sm_free_script(mem_obj_t* mem) {
|
||||
if (!mem) return;
|
||||
if (mem->data.script.buf) {
|
||||
sci_free(mem->data.script.buf);
|
||||
free(mem->data.script.buf);
|
||||
mem->data.script.buf = NULL;
|
||||
mem->data.script.buf_size = 0;
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ sm_free_script(mem_obj_t* mem) {
|
|||
|
||||
delete mem->data.script.obj_indices;
|
||||
if (NULL != mem->data.script.code) {
|
||||
sci_free(mem->data.script.code);
|
||||
free(mem->data.script.code);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1283,7 +1283,7 @@ sm_script_free_unused_objects(seg_manager_t *self, seg_id_t seg) {
|
|||
* scr->objects_nr);
|
||||
else {
|
||||
if (scr->objects_allocated)
|
||||
sci_free(scr->objects);
|
||||
free(scr->objects);
|
||||
scr->objects = NULL;
|
||||
}
|
||||
scr->objects_allocated = scr->objects_nr;
|
||||
|
@ -1378,7 +1378,7 @@ sm_alloc_hunk_entry(seg_manager_t *self, const char *hunk_type, int size, reg_t
|
|||
static void
|
||||
_clone_cleanup(clone_t *clone) {
|
||||
if (clone->variables)
|
||||
sci_free(clone->variables); /* Free the dynamically allocated memory part */
|
||||
free(clone->variables); /* Free the dynamically allocated memory part */
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1604,7 +1604,7 @@ list_all_outgoing_references_nop(seg_interface_t *self, state_t *s, reg_t addr,
|
|||
|
||||
static void
|
||||
deallocate_self(seg_interface_t *self) {
|
||||
sci_free(self);
|
||||
free(self);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1728,7 +1728,7 @@ free_at_address_clones(seg_interface_t *self, reg_t addr) {
|
|||
sciprintf("[GC] Clone "PREG": Freeing\n", PRINT_REG(addr));
|
||||
sciprintf("[GC] Clone had pos "PREG"\n", PRINT_REG(victim_obj->pos));
|
||||
*/
|
||||
sci_free(victim_obj->variables);
|
||||
free(victim_obj->variables);
|
||||
victim_obj->variables = NULL;
|
||||
sm_free_clone(self->segmgr, addr);
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ sys_strings_restore(sys_strings_t *new_strings, sys_strings_t *old_strings) {
|
|||
if (data) {
|
||||
s->value = (char *)sci_malloc(s->max_size + 1);
|
||||
strcpy(s->value, data);
|
||||
sci_free(data);
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2212,7 +2212,7 @@ _game_run(state_t *s, int restoring) {
|
|||
run_vm(s, (successor || restoring) ? 1 : 0);
|
||||
if (s->restarting_flags & SCI_GAME_IS_RESTARTING_NOW) { /* Restart was requested? */
|
||||
|
||||
sci_free(s->execution_stack);
|
||||
free(s->execution_stack);
|
||||
s->execution_stack = NULL;
|
||||
s->execution_stack_pos = -1;
|
||||
s->execution_stack_pos_changed = 0;
|
||||
|
@ -2237,7 +2237,7 @@ _game_run(state_t *s, int restoring) {
|
|||
if (successor) {
|
||||
game_exit(s);
|
||||
script_free_vm_memory(s);
|
||||
sci_free(s);
|
||||
free(s);
|
||||
s = successor;
|
||||
|
||||
if (!send_calls_allocated)
|
||||
|
|
|
@ -2269,11 +2269,11 @@ gfxop_new_text(gfx_state_t *state, int font_nr, char *text, int maxwidth,
|
|||
|
||||
for (j = 0; j < i; j++)
|
||||
gfx_free_pixmap(state->driver, handle->text_pixmaps[j]);
|
||||
sci_free(handle->text_pixmaps);
|
||||
sci_free(handle->text);
|
||||
sci_free(handle->lines);
|
||||
free(handle->text_pixmaps);
|
||||
free(handle->text);
|
||||
free(handle->lines);
|
||||
GFXERROR("Failed to draw text pixmap for line %d/%d\n", i, handle->lines_nr);
|
||||
sci_free(handle);
|
||||
free(handle);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ extern void *
|
|||
/* Allocates the specified amount of memory.
|
||||
** Parameters: (size_t) size: Number of bytes to allocate
|
||||
** Returns : (void *) A pointer to the allocated memory chunk
|
||||
** To free this string, use the sci_free() command.
|
||||
** To free this string, use the free() command.
|
||||
** If the call fails, behaviour is dependent on the definition of SCI_ALLOC.
|
||||
*/
|
||||
|
||||
|
@ -139,7 +139,7 @@ extern void *
|
|||
** Parameters: (size_t) num: Number of elements to allocate
|
||||
** (size_t) size: Amount of memory per element to allocate
|
||||
** Returns : (void *) A pointer to the allocated memory chunk
|
||||
** To free this string, use the sci_free() command.
|
||||
** To free this string, use the free() command.
|
||||
** See _SCI_MALLOC() for more information if call fails.
|
||||
*/
|
||||
|
||||
|
@ -152,17 +152,10 @@ extern void *
|
|||
** bytes of memory and everything contained in the original 'ptr'
|
||||
** (possibly minus some trailing data if the new memory area is
|
||||
** smaller than the old one).
|
||||
** To free this string, use the sci_free() command.
|
||||
** To free this string, use the free() command.
|
||||
** See _SCI_MALLOC() for more information if call fails.
|
||||
*/
|
||||
|
||||
extern void
|
||||
sci_free(void *ptr);
|
||||
/* Frees previously allocated memory chunks
|
||||
** Parameters: (void *) ptr: The pointer to free
|
||||
** Returns : (void)
|
||||
*/
|
||||
|
||||
extern void *
|
||||
sci_memdup(const void *src, size_t size);
|
||||
/* Duplicates a chunk of memory
|
||||
|
@ -170,7 +163,7 @@ extern void *
|
|||
** (size_t) size: Number of bytes to duplicate
|
||||
** Returns : (void *) An appropriately allocated duplicate, or NULL on error
|
||||
** Please try to avoid data duplication unless absolutely neccessary!
|
||||
** To free this string, use the sci_free() command.
|
||||
** To free this string, use the free() command.
|
||||
** See _SCI_MALLOC() for more information if call fails.
|
||||
*/
|
||||
|
||||
|
@ -180,7 +173,7 @@ extern char *
|
|||
** Parameters: (const char *) src: The original pointer
|
||||
** Returns : (char *) a pointer to the storage location for the copied
|
||||
** string.
|
||||
** To free this string, use the sci_free() command.
|
||||
** To free this string, use the free() command.
|
||||
** See _SCI_MALLOC() for more information if call fails.
|
||||
*/
|
||||
|
||||
|
@ -192,7 +185,7 @@ extern char *
|
|||
** (int) length: The maximum length of the string (not counting
|
||||
** a trailing \0).
|
||||
** Returns : (char *) The resulting copy, allocated with sci_malloc().
|
||||
** To free this string, use the sci_free() command.
|
||||
** To free this string, use the free() command.
|
||||
** See _SCI_MALLOC() for more information if call fails.
|
||||
*/
|
||||
|
||||
|
|
|
@ -325,8 +325,8 @@ main_() {
|
|||
game_exit(gamestate);
|
||||
script_free_engine(gamestate); /* Uninitialize game state */
|
||||
script_free_breakpoints(gamestate);
|
||||
sci_free(gamestate->work_dir);
|
||||
sci_free(gamestate);
|
||||
free(gamestate->work_dir);
|
||||
free(gamestate);
|
||||
|
||||
scir_free_resource_manager(resmgr);
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ delete_node(void *x, aatree_t **t, aatree_t *deleted, int (*compar)(const void *
|
|||
deleted->key = (*t)->key;
|
||||
temp = *t;
|
||||
*t = (*t)->right;
|
||||
sci_free(temp);
|
||||
free(temp);
|
||||
retval = 0;
|
||||
} else if (((*t)->left->level < (*t)->level - 1) || ((*t)->right->level < (*t)->level - 1)) {
|
||||
(*t)->level--;
|
||||
|
@ -165,5 +165,5 @@ aatree_free(aatree_t *t) {
|
|||
aatree_free(t->left);
|
||||
aatree_free(t->right);
|
||||
|
||||
sci_free(t);
|
||||
free(t);
|
||||
}
|
||||
|
|
|
@ -78,5 +78,5 @@ void
|
|||
exe_close(exe_file_t *file) {
|
||||
file->decompressor->close(file->handle);
|
||||
|
||||
sci_free(file);
|
||||
free(file);
|
||||
}
|
||||
|
|
|
@ -263,7 +263,7 @@ lzexe_open(const char *filename) {
|
|||
handle = (exe_handle_t*)sci_malloc(sizeof(exe_handle_t));
|
||||
|
||||
if (!lzexe_init(handle, f)) {
|
||||
sci_free(handle);
|
||||
free(handle);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -318,7 +318,7 @@ static void
|
|||
lzexe_close(exe_handle_t *handle) {
|
||||
fclose(handle->f);
|
||||
|
||||
sci_free(handle);
|
||||
free(handle);
|
||||
}
|
||||
|
||||
exe_decompressor_t
|
||||
|
|
|
@ -56,7 +56,7 @@ static void
|
|||
raw_close(exe_handle_t *handle) {
|
||||
fclose(handle->f);
|
||||
|
||||
sci_free(handle);
|
||||
free(handle);
|
||||
}
|
||||
|
||||
exe_decompressor_t
|
||||
|
|
|
@ -608,7 +608,7 @@ scir_new_resource_manager(char *dir, int version,
|
|||
}
|
||||
sciprintf("Resmgr: Could not retrieve a resource list!\n");
|
||||
_scir_free_resource_sources(mgr->sources);
|
||||
sci_free(mgr);
|
||||
free(mgr);
|
||||
chdir(caller_cwd);
|
||||
free(caller_cwd);
|
||||
return NULL;
|
||||
|
@ -721,10 +721,10 @@ _scir_free_resources(resource_t *resources, int resources_nr) {
|
|||
_scir_free_altsources(res->alt_sources);
|
||||
|
||||
if (res->status != SCI_STATUS_NOMALLOC)
|
||||
sci_free(res->data);
|
||||
free(res->data);
|
||||
}
|
||||
|
||||
sci_free(resources);
|
||||
free(resources);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -733,13 +733,13 @@ scir_free_resource_manager(resource_mgr_t *mgr) {
|
|||
_scir_free_resource_sources(mgr->sources);
|
||||
mgr->resources = NULL;
|
||||
|
||||
sci_free(mgr);
|
||||
free(mgr);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
_scir_unalloc(resource_t *res) {
|
||||
sci_free(res->data);
|
||||
free(res->data);
|
||||
res->data = NULL;
|
||||
res->status = SCI_STATUS_NOMALLOC;
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ sci0_read_resource_map(resource_mgr_t *mgr, resource_source_t *map, resource_t *
|
|||
int i;
|
||||
|
||||
if (sci_res_read_entry(mgr, map, buf, resources + resource_index, *sci_version)) {
|
||||
sci_free(resources);
|
||||
free(resources);
|
||||
close(fd);
|
||||
return SCI_ERROR_RESMAP_NOT_FOUND;
|
||||
}
|
||||
|
|
|
@ -76,18 +76,6 @@ sci_realloc(void *ptr, size_t size) {
|
|||
}
|
||||
|
||||
|
||||
void
|
||||
sci_free(void *ptr) {
|
||||
if (!ptr) {
|
||||
fprintf(stderr, "_SCI_FREE() [%s (%s) : %u]\n",
|
||||
__FILE__, "", __LINE__);
|
||||
fprintf(stderr, " attempt to free NULL pointer\n");
|
||||
BREAKPOINT();
|
||||
}
|
||||
free(ptr);
|
||||
}
|
||||
|
||||
|
||||
void *
|
||||
sci_memdup(const void *ptr, size_t size) {
|
||||
void *res;
|
||||
|
@ -201,7 +189,7 @@ extern void
|
|||
#ifdef TRACE_REFCOUNT
|
||||
fprintf(stderr, "[] REF: Freeing (%p)...\n", fdata - 3);
|
||||
#endif
|
||||
sci_free(fdata - 3);
|
||||
free(fdata - 3);
|
||||
#ifdef TRACE_REFCOUNT
|
||||
fprintf(stderr, "[] REF: Done.\n");
|
||||
#endif
|
||||
|
|
|
@ -674,7 +674,7 @@ sci_getcwd(void) {
|
|||
if (getcwd(cwd, size - 1))
|
||||
return cwd;
|
||||
|
||||
sci_free(cwd);
|
||||
free(cwd);
|
||||
}
|
||||
|
||||
fprintf(stderr, "Could not determine current working directory!\n");
|
||||
|
|
|
@ -1000,7 +1000,7 @@ _sci1_get_pcm(sci1_song_iterator_t *self) {
|
|||
|
||||
self->next_sample = self->next_sample->next;
|
||||
|
||||
sci_free(sample);
|
||||
free(sample);
|
||||
|
||||
return feed;
|
||||
} else
|
||||
|
@ -1269,7 +1269,7 @@ _sci1_cleanup(sci1_song_iterator_t *it) {
|
|||
while (sample_seeker) {
|
||||
sci1_sample_t *old_sample = sample_seeker;
|
||||
sample_seeker = sample_seeker->next;
|
||||
sci_free(old_sample);
|
||||
free(old_sample);
|
||||
}
|
||||
|
||||
_sci0_cleanup((sci0_song_iterator_t *)it);
|
||||
|
@ -1383,7 +1383,7 @@ _ff_handle_message(fast_forward_song_iterator_t *self,
|
|||
case _SIMSG_PLASTICWRAP_ACK_MORPH:
|
||||
if (self->delta <= 0) {
|
||||
song_iterator_t *it = self->delegate;
|
||||
sci_free(self);
|
||||
free(self);
|
||||
return it;
|
||||
}
|
||||
break;
|
||||
|
@ -1658,13 +1658,13 @@ _tee_handle_message(tee_song_iterator_t *self, song_iterator_message_t msg) {
|
|||
if (self->may_destroy)
|
||||
songit_free(self->children[TEE_LEFT].it);
|
||||
old_it = self->children[TEE_RIGHT].it;
|
||||
sci_free(self);
|
||||
free(self);
|
||||
return old_it;
|
||||
} else if (!(self->status & TEE_RIGHT_ACTIVE)) {
|
||||
if (self->may_destroy)
|
||||
songit_free(self->children[TEE_RIGHT].it);
|
||||
old_it = self->children[TEE_LEFT].it;
|
||||
sci_free(self);
|
||||
free(self);
|
||||
return old_it;
|
||||
} else {
|
||||
sciprintf("[tee-iterator] WARNING:"
|
||||
|
@ -1949,7 +1949,7 @@ songit_free(song_iterator_t *it) {
|
|||
for (i = 0; i < it->death_listeners_nr; i++)
|
||||
it->death_listeners[i].notify(it->death_listeners[i].self, it);
|
||||
|
||||
sci_free(it);
|
||||
free(it);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ _mix_unsubscribe(sfx_pcm_mixer_t *self, sfx_pcm_feed_t *feed) {
|
|||
feed->destroy(feed);
|
||||
|
||||
if (fs->buf)
|
||||
sci_free(fs->buf);
|
||||
free(fs->buf);
|
||||
|
||||
self->feeds_nr--;
|
||||
|
||||
|
@ -255,16 +255,16 @@ mix_exit(sfx_pcm_mixer_t *self) {
|
|||
_mix_unsubscribe(self, self->feeds[0].feed);
|
||||
|
||||
if (P->outbuf)
|
||||
sci_free(P->outbuf);
|
||||
free(P->outbuf);
|
||||
if (P->writebuf)
|
||||
sci_free(P->writebuf);
|
||||
free(P->writebuf);
|
||||
|
||||
if (P->compbuf_l)
|
||||
sci_free(P->compbuf_l);
|
||||
free(P->compbuf_l);
|
||||
if (P->compbuf_l)
|
||||
sci_free(P->compbuf_r);
|
||||
free(P->compbuf_r);
|
||||
|
||||
sci_free(P);
|
||||
free(P);
|
||||
self->private_bits /* = P */ = NULL;
|
||||
RELEASE_LOCK();
|
||||
|
||||
|
|
|
@ -109,6 +109,6 @@ pi_poll(sfx_pcm_feed_t *self, byte *dest, int size) {
|
|||
static void
|
||||
pi_destroy(sfx_pcm_feed_t *self) {
|
||||
sci_refcount_decref(D->base_data);
|
||||
sci_free(D);
|
||||
sci_free(self);
|
||||
free(D);
|
||||
free(self);
|
||||
}
|
||||
|
|
|
@ -528,8 +528,8 @@ ami_exit(sfx_softseq_t *self) {
|
|||
|
||||
for (i = 0; i < bank.size; i++) {
|
||||
if (bank.instruments[i]) {
|
||||
sci_free(bank.instruments[i]->samples);
|
||||
sci_free(bank.instruments[i]);
|
||||
free(bank.instruments[i]->samples);
|
||||
free(bank.instruments[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue