@@ -315,7 +315,7 @@ void *phpdbg_watchpoint_userfaultfd_thread(void *phpdbg_globals) {
315
315
316
316
struct uffd_msg fault_msg = {0 };
317
317
while (read (globals -> watch_userfaultfd , & fault_msg , sizeof (fault_msg )) == sizeof (fault_msg )) {
318
- void * page = phpdbg_get_page_boundary ((char * )(uintptr_t ) fault_msg .arg .pagefault .address );
318
+ void * page = phpdbg_get_page_boundary ((char * )(uintptr_t ) fault_msg .arg .pagefault .address );
319
319
zend_hash_index_add_empty_element (globals -> watchlist_mem , (zend_ulong ) page );
320
320
struct uffdio_writeprotect unprotect = {
321
321
.mode = 0 ,
@@ -668,7 +668,7 @@ void phpdbg_watch_parent_ht(phpdbg_watch_element *element) {
668
668
}
669
669
670
670
void phpdbg_unwatch_parent_ht (phpdbg_watch_element * element ) {
671
- if (element -> watch -> type == WATCH_ON_BUCKET ) {
671
+ if (element -> watch && element -> watch -> type == WATCH_ON_BUCKET ) {
672
672
phpdbg_btree_result * res = phpdbg_btree_find (& PHPDBG_G (watch_HashTables ), (zend_ulong ) element -> parent_container );
673
673
ZEND_ASSERT (element -> parent_container );
674
674
if (res ) {
@@ -969,11 +969,14 @@ void phpdbg_remove_watchpoint(phpdbg_watchpoint_t *watch) {
969
969
}
970
970
971
971
void phpdbg_clean_watch_element (phpdbg_watch_element * element ) {
972
- HashTable * elements = & element -> watch -> elements ;
973
972
phpdbg_unwatch_parent_ht (element );
974
- zend_hash_del (elements , element -> str );
975
- if (zend_hash_num_elements (elements ) == 0 ) {
976
- phpdbg_remove_watchpoint (element -> watch );
973
+
974
+ if (element -> watch ) {
975
+ HashTable * elements = & element -> watch -> elements ;
976
+ zend_hash_del (elements , element -> str );
977
+ if (zend_hash_num_elements (elements ) == 0 ) {
978
+ phpdbg_remove_watchpoint (element -> watch );
979
+ }
977
980
}
978
981
}
979
982
0 commit comments