php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56416 uninitialized time_t t
Submitted: 2005-06-13 08:38 UTC Modified: 2005-06-13 10:01 UTC
From: Xuefer at 21cn dot com Assigned: rasmus (profile)
Status: Closed Package: APC (PECL)
PHP Version: 4_3 CVS-2005-06-13 (stable) OS: linux
Private report: No CVE-ID: None
 [2005-06-13 08:38 UTC] Xuefer at 21cn dot com
Description:
------------
php_apc.c: In function `_apc_store':
php_apc.c:365: warning: 't' might be used uninitialized in this function

suggested fix:

Index: php_apc.c
===================================================================
RCS file: /repository/pecl/apc/php_apc.c,v
retrieving revision 3.43
diff -u -r3.43 php_apc.c
--- php_apc.c   8 Apr 2005 20:25:38 -0000       3.43
+++ php_apc.c   13 Jun 2005 12:36:14 -0000
@@ -348,12 +348,6 @@
     apc_cache_key_t key;
     time_t t;
 
-    if (!(entry = apc_cache_make_user_entry(strkey, val, ttl))) {
-        apc_cache_expunge(APCG(cache),t);
-        apc_cache_expunge(APCG(user_cache),t);
-        return 0;
-    }
-
 #if HAVE_APACHE
     /* Save a syscall here under Apache.  This should actually be a SAPI call instead
      * but we don't have that yet.  Once that is introduced in PHP this can be cleaned up  -Rasmus */
@@ -362,6 +356,12 @@
     t = time(0);
 #endif
 
+    if (!(entry = apc_cache_make_user_entry(strkey, val, ttl))) {
+        apc_cache_expunge(APCG(cache),t);
+        apc_cache_expunge(APCG(user_cache),t);
+        return 0;
+    }
+
     if (!apc_cache_make_user_key(&key, strkey, t)) {
         apc_cache_free_entry(entry);
         apc_cache_expunge(APCG(cache),t);

Reproduce code:
---------------
introduced in:
http://cvs.php.net/diff.php/pecl/apc/php_apc.c?r1=3.41&r2=3.42&ty=h


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-06-13 10:01 UTC] rasmus@php.net
Fixed in CVS
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 17:01:31 2024 UTC