diff options
| author | Hauke Mehrtens | 2026-04-23 22:11:46 +0000 |
|---|---|---|
| committer | Hauke Mehrtens | 2026-06-07 11:23:06 +0000 |
| commit | f227ab4f1285237d58f138a69fc69b37ae774b46 (patch) | |
| tree | 2f1d3953ad08b650e57c4c055f2ef7552ec29e20 | |
| parent | 7a0aa2e4afb4993b7985094aa6847b9fcb04fae8 (diff) | |
| download | uclient-f227ab4f1285237d58f138a69fc69b37ae774b46.tar.gz | |
uclient: fix memory leak of url when backend alloc fails
If backend->alloc() returned NULL, uclient_new() returned without
freeing the url structure parsed earlier, leaking it.
Assisted-by: Claude:claude-opus-4-7
Link: https://github.com/openwrt/uclient/pull/16
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
| -rw-r--r-- | uclient.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -257,8 +257,10 @@ struct uclient *uclient_new(const char *url_str, const char *auth_str, const str return NULL; cl = url->backend->alloc(); - if (!cl) + if (!cl) { + free(url); return NULL; + } cl->backend = url->backend; cl->cb = cb; |