input_stream: added function input_stream_deinit()

All close() implementations must call this method.
This commit is contained in:
Max Kellermann 2010-01-18 09:57:53 +01:00
parent a0a26d3341
commit fb9bd53328
9 changed files with 16 additions and 2 deletions

View File

@ -182,6 +182,7 @@ bz2_open_stream(struct archive_file *file,
bis->base.seekable = false; bis->base.seekable = false;
if (!bz2_alloc(bis, error_r)) { if (!bz2_alloc(bis, error_r)) {
input_stream_deinit(&bis->base);
g_free(bis); g_free(bis);
return NULL; return NULL;
} }
@ -202,6 +203,7 @@ bz2_is_close(struct input_stream *is)
bz2_close(&bis->archive->base); bz2_close(&bis->archive->base);
input_stream_deinit(&bis->base);
g_free(bis); g_free(bis);
} }

View File

@ -212,6 +212,9 @@ iso9660_input_close(struct input_stream *is)
g_free(iis->statbuf); g_free(iis->statbuf);
iso9660_archive_close(&iis->archive->base); iso9660_archive_close(&iis->archive->base);
input_stream_deinit(&iis->base);
g_free(iis);
} }

View File

@ -171,6 +171,7 @@ zzip_input_close(struct input_stream *is)
zzip_file_close(zis->file); zzip_file_close(zis->file);
zzip_archive_close(&zis->archive->base); zzip_archive_close(&zis->archive->base);
input_stream_deinit(&zis->base);
g_free(zis); g_free(zis);
} }

View File

@ -195,6 +195,7 @@ input_curl_free(struct input_curl *c)
g_queue_free(c->buffers); g_queue_free(c->buffers);
g_free(c->url); g_free(c->url);
input_stream_deinit(&c->base);
g_free(c); g_free(c);
} }

View File

@ -136,6 +136,7 @@ input_file_close(struct input_stream *is)
struct file_input_stream *fis = (struct file_input_stream *)is; struct file_input_stream *fis = (struct file_input_stream *)is;
close(fis->fd); close(fis->fd);
input_stream_deinit(&fis->base);
g_free(fis); g_free(fis);
} }

View File

@ -103,6 +103,7 @@ input_mms_close(struct input_stream *is)
struct input_mms *m = (struct input_mms *)is; struct input_mms *m = (struct input_mms *)is;
mmsx_close(m->mms); mmsx_close(m->mms);
input_stream_deinit(&m->base);
g_free(m); g_free(m);
} }

View File

@ -98,6 +98,7 @@ input_rewind_close(struct input_stream *is)
input_stream_close(r->input); input_stream_close(r->input);
input_stream_deinit(&r->base);
g_free(r); g_free(r);
} }

View File

@ -99,8 +99,6 @@ input_stream_read(struct input_stream *is, void *ptr, size_t size,
void input_stream_close(struct input_stream *is) void input_stream_close(struct input_stream *is)
{ {
g_free(is->mime);
is->plugin->close(is); is->plugin->close(is);
} }

View File

@ -76,6 +76,12 @@ input_stream_init(struct input_stream *is, const struct input_plugin *plugin)
is->mime = NULL; is->mime = NULL;
} }
static inline void
input_stream_deinit(struct input_stream *is)
{
g_free(is->mime);
}
/** /**
* Opens a new input stream. You may not access it until the "ready" * Opens a new input stream. You may not access it until the "ready"
* flag is set. * flag is set.