summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-12 22:06:14 +0200
committerwm4 <wm4@nowhere>2013-07-12 22:16:26 +0200
commitb66c609b4826059d348f6e1c049a34cc43415383 (patch)
tree943f9fa31dbc119c618d4c7ccfcfd6bc8602d2b8 /stream
parent5c1b8d4aa1d35c806159cb22d52449774eb5186e (diff)
downloadmpv-b66c609b4826059d348f6e1c049a34cc43415383.tar.bz2
mpv-b66c609b4826059d348f6e1c049a34cc43415383.tar.xz
stream: use talloc for some string members
Minor simplification.
Diffstat (limited to 'stream')
-rw-r--r--stream/stream.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/stream/stream.c b/stream/stream.c
index 39fc872169..ead4a55b3d 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -157,12 +157,11 @@ static stream_t *open_stream_plugin(const stream_info_t *sinfo,
}
s = new_stream(0);
s->opts = options;
- s->url = strdup(filename);
+ s->url = talloc_strdup(s, filename);
s->flags = 0;
s->mode = mode;
*ret = sinfo->open(s, mode, arg);
if ((*ret) != STREAM_OK) {
- free(s->url);
talloc_free(s);
return NULL;
}
@@ -598,6 +597,9 @@ static stream_t *new_stream(size_t min_size)
void free_stream(stream_t *s)
{
+ if (!s)
+ return;
+
stream_set_capture_file(s, NULL);
if (s->close)
@@ -605,9 +607,7 @@ void free_stream(stream_t *s)
if (s->fd > 0) {
close(s->fd);
}
- free(s->url);
- if (s->uncached_stream)
- free_stream(s->uncached_stream);
+ free_stream(s->uncached_stream);
talloc_free(s);
}
@@ -675,9 +675,9 @@ int stream_enable_cache(stream_t **stream, int64_t size, int64_t min,
cache->mode = STREAM_READ;
cache->read_chunk = 4 * STREAM_BUFFER_SIZE;
- cache->url = strdup(orig->url);
+ cache->url = talloc_strdup(cache, orig->url);
cache->mime_type = talloc_strdup(cache, orig->mime_type);
- cache->lavf_type = orig->lavf_type;
+ cache->lavf_type = talloc_strdup(cache, orig->lavf_type);
cache->opts = orig->opts;
cache->start_pos = orig->start_pos;
cache->end_pos = orig->end_pos;