View Issue Details

IDProjectCategoryView StatusLast Update
0009635GNUnetutil librarypublic2025-04-11 14:33
Reporterfefe Assigned Toschanzen  
PrioritynormalSeverityminorReproducibilityhave not tried
Status feedbackResolutionopen 
Target Version0.24.2 
Summary0009635: question about linked lists
Description  1916 #define GNUNET_CONTAINER_DLL_remove(head, tail, element) \
  1917 do \
  1918 { \
  1919 GNUNET_assert (((element)->prev != NULL) || ((head) == (element))); \
  1920 GNUNET_assert (((element)->next != NULL) || ((tail) == (element))); \
  1921 if ((element)->prev == NULL) \
  1922 (head) = (element)->next; \
  1923 else \
  1924 (element)->prev->next = (element)->next; \
  1925 if ((element)->next == NULL) \
  1926 (tail) = (element)->prev; \
  1927 else \
  1928 (element)->next->prev = (element)->prev; \
  1929 (element)->next = NULL; \
  1930 (element)->prev = NULL; \
  1931 } while (0)

If you remove the last element in the list, head and tail are left pointing to the removed element.
Isn't that a problem?
TagsNo tags attached.

Activities

schanzen

2025-03-20 19:39

administrator   ~0024264

no they are set to NULL in lines 1922 and 1926, respectively as prev and next are null by defintion (last element).

schanzen

2025-03-20 19:41

administrator   ~0024265

if you mean the list len is larger than one this is also correct I think, unless the prev or next pointer of the element is corrupted

schanzen

2025-04-11 14:33

administrator   ~0024509

Moving this to 0.24.2 for now but need feedback if this really is an issue and why

Issue History

Date Modified Username Field Change
2025-03-18 14:48 fefe New Issue
2025-03-20 19:39 schanzen Note Added: 0024264
2025-03-20 19:41 schanzen Note Added: 0024265
2025-03-20 19:43 schanzen Target Version => 0.24.1
2025-04-11 14:33 schanzen Assigned To => schanzen
2025-04-11 14:33 schanzen Status new => feedback
2025-04-11 14:33 schanzen Note Added: 0024509
2025-04-11 14:33 schanzen Target Version 0.24.1 => 0.24.2