summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-11-01 00:24:08 +0100
committerwm4 <wm4@nowhere>2012-11-01 02:12:17 +0100
commit73f866e7ebaf11f855d255649b5f57d6d19f541c (patch)
tree21edd2c9f0cd874d4b3b258f59e373348b65654a
parent0212d7e804da82784bb2c60c08fc86e8aa160874 (diff)
downloadmpv-73f866e7ebaf11f855d255649b5f57d6d19f541c.tar.bz2
mpv-73f866e7ebaf11f855d255649b5f57d6d19f541c.tar.xz
tl_matroska: fix NULL pointer issue
Found by clang analyzer. Probably doesn't matter in practice, because the number of entries was 0 when entries was NULL.
-rw-r--r--timeline/tl_matroska.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/timeline/tl_matroska.c b/timeline/tl_matroska.c
index 30694fff24..9387201866 100644
--- a/timeline/tl_matroska.c
+++ b/timeline/tl_matroska.c
@@ -103,7 +103,8 @@ static char **find_files(const char *original_file, const char *suffix)
}
closedir(dp);
// NOTE: maybe should make it compare pointers instead
- qsort(entries, num_results, sizeof(struct find_entry), cmp_entry);
+ if (entries)
+ qsort(entries, num_results, sizeof(struct find_entry), cmp_entry);
results = talloc_realloc(NULL, results, char *, num_results);
for (int i = 0; i < num_results; i++) {
results[i] = entries[i].name;