Warning, /graphics/okular/core/synctex/patches/15-prevent-leaks-and-segfault.diff is written in an unsupported language. File is not indexed.

0001 Plug multiple leaks and prevent a segfault:
0002 - When the returned value to be assigned to reader is NULL, reader should be freed beforehand.
0003 - Do not leak memory when scanner creation succeeded, but no synctex file was found.
0004 - A valid reader is the prerequisite for accessing SYNCTEX_FILE.
0005 - Two calls to malloc() for reader->start also require two calls to free().
0006 
0007 Author: Henrik Fehlauer <rkflx@lab12.net>
0008 
0009 
0010 Index: synctex/synctex_parser.c
0011 ===================================================================
0012 --- synctex.orig/synctex_parser.c
0013 +++ synctex/synctex_parser.c
0014 @@ -739,6 +739,7 @@ synctex_reader_p synctex_reader_init_wit
0015          if (open.status<SYNCTEX_STATUS_OK) {
0016              open = _synctex_open_v2(output,build_directory,0,synctex_DONT_ADD_QUOTES);
0017              if (open.status<SYNCTEX_STATUS_OK) {
0018 +                synctex_reader_free(reader);
0019                  return NULL;
0020              }
0021          }
0022 @@ -5840,6 +5841,7 @@ synctex_scanner_p synctex_scanner_new_wi
0023  #if defined(SYNCTEX_DEBUG)
0024      _synctex_error("No file?");
0025  #endif
0026 +    synctex_scanner_free(scanner);
0027      return NULL;
0028  }
0029  
0030 @@ -5848,7 +5850,7 @@ synctex_scanner_p synctex_scanner_new_wi
0031  int synctex_scanner_free(synctex_scanner_p scanner) {
0032      int node_count = 0;
0033      if (scanner) {
0034 -        if (SYNCTEX_FILE) {
0035 +        if (scanner->reader && SYNCTEX_FILE) {
0036              gzclose(SYNCTEX_FILE);
0037              SYNCTEX_FILE = NULL;
0038          }
0039 @@ -5883,6 +5885,15 @@ synctex_scanner_p synctex_scanner_parse(
0040      scanner->x_offset = scanner->y_offset = 6.027e23f;
0041      scanner->reader->line_number = 1;
0042  
0043 +    /* TODO: cleanup
0044 +     * In some (all?) cases SYNCTEX_START is already initialized
0045 +     * in synctex_reader_init_with_output_file(). Much of the
0046 +     * following code seems like a duplicate and is perhaps a
0047 +     * candidate for deletion. To be on the safe side though, we
0048 +     * keep it for now and just free() any prior malloc() if
0049 +     * existing. */
0050 +    _synctex_free(SYNCTEX_START);
0051 +
0052      SYNCTEX_START = (char *)malloc(SYNCTEX_BUFFER_SIZE+1); /*  one more character for null termination */
0053      if (NULL == SYNCTEX_START) {
0054          _synctex_error("!  malloc error in synctex_scanner_parse.");