aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-02-22 22:43:06 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-02-22 22:51:13 +0100
commit0a32a1b4bbcdffe5c6a61a9e8ea64a17bf31f172 (patch)
tree6ebbe6168b1fea8fa9c64e6813570b8718b375ae
parent704c980294aa8d442636e3a51121b74a6eb366bf (diff)
downloadffmpeg-0a32a1b4bbcdffe5c6a61a9e8ea64a17bf31f172.tar.gz
tools/graph2dot: Check for av_malloc() failure
Fixes CID1271047 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--tools/graph2dot.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/graph2dot.c b/tools/graph2dot.c
index 964322d080..5552b3400d 100644
--- a/tools/graph2dot.c
+++ b/tools/graph2dot.c
@@ -157,9 +157,17 @@ int main(int argc, char **argv)
struct line *line, *last_line, *first_line;
char *p;
last_line = first_line = av_malloc(sizeof(struct line));
+ if (!last_line) {
+ fprintf(stderr, "Memory allocation failure\n");
+ return 1;
+ }
while (fgets(last_line->data, sizeof(last_line->data), infile)) {
struct line *new_line = av_malloc(sizeof(struct line));
+ if (!new_line) {
+ fprintf(stderr, "Memory allocation failure\n");
+ return 1;
+ }
count += strlen(last_line->data);
last_line->next = new_line;
last_line = new_line;
@@ -167,6 +175,10 @@ int main(int argc, char **argv)
last_line->next = NULL;
graph_string = av_malloc(count + 1);
+ if (!graph_string) {
+ fprintf(stderr, "Memory allocation failure\n");
+ return 1;
+ }
p = graph_string;
for (line = first_line; line->next; line = line->next) {
unsigned int l = strlen(line->data);