diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2013-07-07 01:52:51 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2013-07-07 21:43:23 +0200 |
commit | 636ced8e1dc8248a1353b416240b93d70ad03edb (patch) | |
tree | 6a157f3eb215b97d50fd96ff43d7ae6581a7e9af /avprobe.c | |
parent | 21732063a346475eb22c332b27e8216b79f9ad4a (diff) | |
download | ffmpeg-636ced8e1dc8248a1353b416240b93d70ad03edb.tar.gz |
cmdutils: wrap exit explicitly
Some C runtime implementations deadlock when calling threading functions
on the atexit() handler.
Use a simpler wrapper similar to av_log to call the cleanup function
before exit.
Bug-Id: 523
Diffstat (limited to 'avprobe.c')
-rw-r--r-- | avprobe.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -60,7 +60,7 @@ static const char unit_hertz_str[] = "Hz" ; static const char unit_byte_str[] = "byte" ; static const char unit_bit_per_second_str[] = "bit/s"; -static void exit_program(void) +static void avprobe_cleanup(int ret) { av_dict_free(&fmt_entries_to_show); } @@ -366,7 +366,7 @@ static void probe_group_enter(const char *name, int type) if (!octx.prefix || !name) { fprintf(stderr, "Out of memory\n"); - exit(1); + exit_program(1); } if (octx.level) { @@ -854,7 +854,7 @@ static void opt_input_file(void *optctx, const char *arg) fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n", arg, input_filename); - exit(1); + exit_program(1); } if (!strcmp(arg, "-")) arg = "pipe:"; @@ -919,7 +919,7 @@ int main(int argc, char **argv) if (!buffer) exit(1); - atexit(exit_program); + register_exit(avprobe_cleanup); options = real_options; parse_loglevel(argc, argv, options); @@ -949,13 +949,13 @@ int main(int argc, char **argv) fprintf(stderr, "Use -h to get full help or, even better, run 'man %s'.\n", program_name); - exit(1); + exit_program(1); } probe_out = avio_alloc_context(buffer, AVP_BUFFSIZE, 1, NULL, NULL, probe_buf_write, NULL); if (!probe_out) - exit(1); + exit_program(1); probe_header(); ret = probe_file(input_filename); |