Yet another resource leak. Coverity ID 123.
[openssl.git] / crypto / comp / comp_err.c
index 1652b8c2c4a1faf52280727077e68e35e119378f..aad3235cf3dcfbbf873261b5d1508fcc2f7cd733 100644 (file)
@@ -1,6 +1,6 @@
 /* crypto/comp/comp_err.c */
 /* ====================================================================
- * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 1999-2006 The OpenSSL Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 /* BEGIN ERROR CODES */
 #ifndef OPENSSL_NO_ERR
+
+#define ERR_FUNC(func) ERR_PACK(ERR_LIB_COMP,func,0)
+#define ERR_REASON(reason) ERR_PACK(ERR_LIB_COMP,0,reason)
+
 static ERR_STRING_DATA COMP_str_functs[]=
        {
 {0,NULL}
@@ -78,15 +82,12 @@ static ERR_STRING_DATA COMP_str_reasons[]=
 
 void ERR_load_COMP_strings(void)
        {
-       static int init=1;
-
-       if (init)
-               {
-               init=0;
 #ifndef OPENSSL_NO_ERR
-               ERR_load_strings(ERR_LIB_COMP,COMP_str_functs);
-               ERR_load_strings(ERR_LIB_COMP,COMP_str_reasons);
-#endif
 
+       if (ERR_func_error_string(COMP_str_functs[0].error) == NULL)
+               {
+               ERR_load_strings(0,COMP_str_functs);
+               ERR_load_strings(0,COMP_str_reasons);
                }
+#endif
        }