1 /* Reduced from SoftEtherVPN's src/Cedar/WebUI.c. */
2 /* { dg-additional-options "-Wno-analyzer-symbol-too-complex" } */
4 #include "../../gcc.dg/analyzer/analyzer-decls.h"
5 typedef int (COMPARE
)(void *p1
, void *p2
);
6 typedef unsigned int UINT
;
7 typedef unsigned long int UINT64
;
8 typedef struct LIST LIST
;
9 typedef struct STRMAP_ENTRY STRMAP_ENTRY
;
16 typedef struct WU_CONTEXT
25 UINT num_item
, num_reserved
;
30 #define LIST_DATA(o, i) (((o) != NULL) ? ((o)->p[(i)]) : NULL)
31 #define LIST_NUM(o) (((o) != NULL) ? (o)->num_item : 0)
44 void Free(void *addr
);
45 void Add(LIST
*o
, void *p
);
46 _Bool
Delete(LIST
*o
, void *p
);
47 void LockList(LIST
*o
);
48 void UnlockList(LIST
*o
);
49 void ReleaseList(LIST
*o
);
50 LIST
*NewList(COMPARE
*cmp
);
52 void WuFreeContext(WU_CONTEXT
*context
);
54 void WuExpireSessionKey(WEBUI
*wu
)
56 LIST
*Expired
= NewList(NULL
);
59 LockList(wu
->Contexts
);
61 for(i
=0; i
<LIST_NUM(wu
->Contexts
); i
++)
63 STRMAP_ENTRY
*entry
= (STRMAP_ENTRY
*)LIST_DATA(wu
->Contexts
, i
);
64 WU_CONTEXT
*context
= (WU_CONTEXT
*)entry
->Value
; /* { dg-bogus "dereference of NULL 'entry'" "PR analyzer/108400" { xfail *-*-* } } */
65 if(context
->ExpireDate
< Tick64())
71 for(i
=0; i
<LIST_NUM(Expired
); i
++)
73 STRMAP_ENTRY
*entry
= (STRMAP_ENTRY
*)LIST_DATA(Expired
, i
);
74 Delete(wu
->Contexts
, entry
);
76 WuFreeContext((WU_CONTEXT
*)entry
->Value
);
81 UnlockList(wu
->Contexts
);