Commit 0ade6a5
Marcel Hecko
Fix early_announce crash on DB connect and resource leaks (#287)
- Check fopen() return before fwrite(): when fopen fails (permissions,
SELinux, full disk) the NULL FILE* was passed to fwrite(), causing
segfault at address 1 inside glibc — the exact crash reported.
- Move delete stmt/result before return so they are actually reached;
the previous code returned before the deletes, leaking on every query.
- Add cleanup of stmt/result in the catch block so an SQL exception
does not leak the already-allocated objects.
- Guard the get_announce_file function-pointer call in onInvite()
against NULL (module not initialised), returning 500 instead of
crashing the process.
- Add missing <string.h> and <errno.h> includes for strerror(errno).
Closes #2871 parent a1bcde9 commit 0ade6a5
2 files changed
+28
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
97 | 100 | | |
98 | | - | |
| 101 | + | |
99 | 102 | | |
100 | 103 | | |
101 | | - | |
102 | | - | |
| 104 | + | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
113 | 121 | | |
114 | 122 | | |
115 | | - | |
116 | 123 | | |
117 | 124 | | |
118 | | - | |
119 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
120 | 129 | | |
121 | 130 | | |
122 | 131 | | |
123 | 132 | | |
124 | 133 | | |
| 134 | + | |
| 135 | + | |
125 | 136 | | |
126 | 137 | | |
127 | 138 | | |
| |||
332 | 343 | | |
333 | 344 | | |
334 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
335 | 351 | | |
336 | | - | |
| 352 | + | |
337 | 353 | | |
338 | 354 | | |
339 | 355 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
0 commit comments