logo       

cvs: pecl /apc apc_compile.c: msg#00221

php.pecl.cvs

Subject: cvs: pecl /apc apc_compile.c

iliaa Wed Jul 27 12:38:46 2005 EDT

Modified files:
/pecl/apc apc_compile.c
Log:
Fixed possible crash when allocation fails (low shm mem situation).


http://cvs.php.net/diff.php/pecl/apc/apc_compile.c?r1=3.23&r2=3.24&ty=u
Index: pecl/apc/apc_compile.c
diff -u pecl/apc/apc_compile.c:3.23 pecl/apc/apc_compile.c:3.24
--- pecl/apc/apc_compile.c:3.23 Sat Jul 16 22:24:33 2005
+++ pecl/apc/apc_compile.c Wed Jul 27 12:38:45 2005
@@ -28,7 +28,7 @@

*/

-/* $Id: apc_compile.c,v 3.23 2005/07/17 02:24:33 rasmus Exp $ */
+/* $Id: apc_compile.c,v 3.24 2005/07/27 16:38:45 iliaa Exp $ */

#include "apc_compile.h"
#include "apc_globals.h"
@@ -1277,6 +1277,7 @@
if(!(dst->vars[i].name = apc_xmemcpy(src->vars[i].name,
src->vars[i].name_len + 1,
allocate))) {
+ src->last_var = i;
goto cleanup_opcodes;
}
}
@@ -1313,8 +1314,10 @@
if(dst->brk_cont_array) deallocate(dst->brk_cont_array);
if(dst->static_variables) my_free_hashtable(dst->static_variables,
(ht_free_fun_t)my_free_zval_ptr, (apc_free_t)deallocate);
#ifdef ZEND_ENGINE_2_1
- for(i=0; i < src->last_var; i++) {
- if(dst->vars[i].name) deallocate(dst->vars[i].name);
+ if (dst->vars) {
+ for(i=0; i < src->last_var; i++) {
+ if(dst->vars[i].name) deallocate(dst->vars[i].name);
+ }
}
#endif
if(local_dst_alloc) deallocate(dst);



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise