diff options
author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2024-02-19 12:54:07 +0100 |
---|---|---|
committer | Sander Vrijders <sander@ouroboros.rocks> | 2024-02-19 14:09:38 +0100 |
commit | 52f4d6f7b72de7308b4200b5c4b6c3ccddf617a3 (patch) | |
tree | 98cb622e91bbc20cc9e76dd90ef28dfa656c41f7 /src | |
parent | a23b29ea4c1bd9d0407b2b070eb2dc9ad15e71cc (diff) | |
download | ouroboros-52f4d6f7b72de7308b4200b5c4b6c3ccddf617a3.tar.gz ouroboros-52f4d6f7b72de7308b4200b5c4b6c3ccddf617a3.zip |
irmd: Fix free of uninitialized ptr
The reg_list_ipcps function left *ipcps uninitialized when there were
no IPCPs in the system. This caused a free to SEGV in the IRMd when
trying to allocate a flow.
Signed-off-by: Dimitri Staessens <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src')
-rw-r--r-- | src/irmd/reg/reg.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/irmd/reg/reg.c b/src/irmd/reg/reg.c index 29d2a7ba..f486c1cc 100644 --- a/src/irmd/reg/reg.c +++ b/src/irmd/reg/reg.c @@ -911,8 +911,10 @@ int reg_list_ipcps(ipcp_list_msg_t *** ipcps) pthread_mutex_lock(®.mtx); - if (reg.n_ipcps == 0) + if (reg.n_ipcps == 0) { + *ipcps = NULL; goto finish; + } *ipcps = malloc(reg.n_ipcps * sizeof(**ipcps)); if (*ipcps == NULL) { @@ -2158,4 +2160,3 @@ int reg_respond_ipcp(const struct ipcp_info * info) pthread_mutex_unlock(®.mtx); return -EIPCP; } - |