]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
fr_strerror_clear() needn't bother with fr_strerror_init() (CID #1503892) (#4486)
authorJames Jones <jejones3141@gmail.com>
Thu, 5 May 2022 21:56:46 +0000 (16:56 -0500)
committerGitHub <noreply@github.com>
Thu, 5 May 2022 21:56:46 +0000 (23:56 +0200)
fr_strerror_clear() already refers to fr_strerror_buffer, and might as
well use it rather than the return value from fr_sterror_init().

src/lib/util/strerror.c

index 90224ef60d5e81abbbc6be3f3f06161ec936082d..5ffe513e271fe0589de77c91d4bf8c807cc85fb0 100644 (file)
@@ -538,11 +538,10 @@ char const *fr_strerror(void)
  */
 void fr_strerror_clear(void)
 {
-       fr_log_buffer_t         *buffer;
+       fr_log_buffer_t         *buffer = fr_strerror_buffer;
 
-       if (unlikely(!fr_strerror_buffer)) return;
+       if (unlikely(!buffer)) return;
 
-       buffer = fr_strerror_init();
        fr_dlist_clear(&buffer->entries);
        talloc_free_children(buffer->pool_a);
        talloc_free_children(buffer->pool_b);