Commit 23ed1e4
Fix dangling pointer after client.close (#527)
* Test(client): Add dead test after closing client
We recently encountered an unexpected Segmentation Fault Error when
checking whether a client was dead after closing it.
To consider this in the future, I've updated the test cases for the
client to include this scenario, so we can catch any issues earlier on.
* Fix(client) Set dangling pointer to NULL after client closure
We recently encountered an unexpected Segmentation Fault Error while
checking if a client was dead after closing it. Upon investigation, we
discovered that the issue was caused by deallocating all memory used by
the client structure without setting the pointer to NULL after closing
the client connection through dbclose. This resulted in a dangling
pointer, which led to the Segmentation Fault when we tried to check
whether the client was dead using TDS dbdead.
To prevent this issue from occurring again, I have made the necessary
updates to set the client pointer to NULL after every dbclose. This will
ensure that we avoid any dangling pointers and keep our code running
smoothly.
---------
Co-authored-by: Matias Martini <martini@fintual.com>1 parent 12a2e45 commit 23ed1e4
3 files changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
| 235 | + | |
235 | 236 | | |
236 | 237 | | |
237 | 238 | | |
| |||
263 | 264 | | |
264 | 265 | | |
265 | 266 | | |
| 267 | + | |
266 | 268 | | |
267 | 269 | | |
268 | 270 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
0 commit comments