]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
global: Explicit free functions for memory that's also freed by thread-local destruct...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 13 Mar 2020 00:21:58 +0000 (20:21 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Fri, 13 Mar 2020 00:21:58 +0000 (20:21 -0400)
Because they're not needed, because we fixed the underlying issue, and now they cause a double free!

src/bin/unit_test_attribute.c
src/bin/unit_test_map.c
src/bin/unit_test_module.c
src/lib/util/strerror.c
src/lib/util/strerror.h
src/lib/util/syserror.c
src/lib/util/syserror.h

index b9e89f568f8ab950ce00a2fcaf5b46764a49dabc..76cac1d4c25478c61b6e94654e0b9b7a70184bb8 100644 (file)
@@ -2541,12 +2541,6 @@ cleanup:
                ret = EXIT_FAILURE;
        }
 
-       /*
-        *      Must be last, we still need the errors
-        *      from fr_touch.
-        */
-       fr_strerror_free();
-
        /*
         *      Explicitly free the autofree context
         *      to make errors less confusing.
index 844d208f9f9f3199556895035cdbf63dd2873f43..e9c15eacdeafffd66c8948e605574466e974a875 100644 (file)
@@ -251,8 +251,6 @@ cleanup:
 
        fr_dict_free(&dict);
 
-       fr_strerror_free();
-
        if (receipt_file && (ret == EXIT_SUCCESS) && (fr_touch(NULL, receipt_file, 0644, true, 0755) <= 0)) {
                fr_perror("unit_test_map");
                ret = EXIT_FAILURE;
index 96fc69a526dfdf3e191d8997589f1e677cb250a4..b6b561d6c51e50d241e33bfe6ca49f991f43487d 100644 (file)
@@ -1171,12 +1171,6 @@ cleanup:
                ret = EXIT_FAILURE;
        }
 
-       /*
-        *      Explicitly cleanup the buffer used for storing syserror messages
-        *      This cuts down on address sanitiser output on error.
-        */
-       fr_syserror_free();
-
        return ret;
 }
 
index 21e2a39b97aafe823b4fabcf8682435b517a730f..1f12955f3f819cb8873f171c413d9e199e9e7f86 100644 (file)
@@ -322,17 +322,6 @@ void fr_perror(char const *fmt, ...)
        talloc_free(prefix);
 }
 
-/** Explicitly free the memory used by fr_strerror
- *
- *  Note that this function is ONLY called in single-threaded mode,
- *  and then ONLY when the main thread does not call pthread_exit(NULL)
- */
-void fr_strerror_free(void)
-{
-       TALLOC_FREE(fr_strerror_buffer);
-       logging_stop = true;
-}
-
 #ifdef TESTING_STRERROR
 /*
  *  cc strerror.c -g3 -Wall -DTESTING_STRERROR -L/usr/local/lib -L ../../../build/lib/local/.libs/ -lfreeradius-util -I/usr/local/include -I../../ -I../ -include ../include/build.h -l talloc -o test_strerror && ./test_strerror
index 36e8db9a7bec1b9516fac2851e9e1c13374ba50c..a658f17abe4b453bed6eb808f02f5898391bdc27 100644 (file)
@@ -41,7 +41,6 @@ char const    *fr_strerror_peek(void);
 char const     *fr_strerror_pop(void);
 
 void           fr_perror(char const *, ...) CC_HINT(format (printf, 1, 2));
-void           fr_strerror_free(void);
 
 #ifdef __cplusplus
 }
index 7baaebeefd75f8157a6ff632be6af8334d5de971..0ca3c2170973dacac0aca5f496f0e7190a82931d 100644 (file)
@@ -259,12 +259,3 @@ char const *fr_syserror(int num)
        }
 #endif
 }
-
-/** Explicitly cleanup the thread specific buffer used
- *
- */
-void fr_syserror_free(void)
-{
-       _fr_logging_free(NULL);
-}
-
index 5239ffc72a3b6b04fcd6bf1dabb3528b2b73da85..80147189c8d55b7de8445d252319f1adf6d77c5e 100644 (file)
@@ -36,7 +36,6 @@ extern "C" {
 #include <string.h>
 
 char const     *fr_syserror(int num);
-void           fr_syserror_free(void);
 
 #ifdef __cplusplus
 }