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