From 825ded92c4632e5a7b08c35082d8b51428ef4c0a Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Wed, 5 Oct 2011 20:33:03 +1100 Subject: [PATCH] + added check for NULL-pointer --- src/torrent2json.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/torrent2json.c b/src/torrent2json.c index 9280d07..6af785c 100644 --- a/src/torrent2json.c +++ b/src/torrent2json.c @@ -165,7 +165,11 @@ main(int argc, char **argv) /* FILE */ in = stdin; /* FILE */ out = stdout; - gen = yajl_gen_alloc(NULL); + if ((gen = yajl_gen_alloc(NULL)) == NULL) + { + fprintf(stderr, "Can't allocate json generator. Exiting."); + exit(EXIT_FAILURE); + } yajl_gen_config(gen, yajl_gen_beautify, 1); yajl_gen_config(gen, yajl_gen_indent_string, "\t");