Skip to content

Commit 29f6547

Browse files
committed
fix(userspace/libscap): free after adding to hash map
Signed-off-by: Lorenzo Fontana <[email protected]>
1 parent f150663 commit 29f6547

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

userspace/libscap/scap_fds.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,7 @@ int32_t scap_fd_handle_socket(scap_t *handle, char *fname, scap_threadinfo *tinf
10171017
if(uth_status != SCAP_SUCCESS)
10181018
{
10191019
snprintf(error, SCAP_LASTERR_SIZE, "socket list allocation error");
1020+
free(sockets);
10201021
return SCAP_FAILURE;
10211022
}
10221023

@@ -1183,6 +1184,7 @@ int32_t scap_fd_read_unix_sockets_from_proc_fs(scap_t *handle, const char* filen
11831184
{
11841185
snprintf(handle->m_lasterr, SCAP_LASTERR_SIZE, "unix socket allocation error");
11851186
fclose(f);
1187+
free(fdinfo);
11861188
return SCAP_FAILURE;
11871189
}
11881190
}
@@ -1498,6 +1500,7 @@ int32_t scap_fd_read_ipv4_sockets_from_proc_fs(scap_t *handle, const char *dir,
14981500
{
14991501
uth_status = SCAP_FAILURE;
15001502
snprintf(handle->m_lasterr, SCAP_LASTERR_SIZE, "ipv4 socket allocation error");
1503+
free(fdinfo);
15011504
break;
15021505
}
15031506

userspace/libscap/scap_procs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1396,6 +1396,7 @@ int32_t scap_update_suppressed(scap_t *handle,
13961396
if(uth_status != SCAP_SUCCESS)
13971397
{
13981398
snprintf(handle->m_lasterr, SCAP_LASTERR_SIZE, "can't add tid to suppressed hash table");
1399+
free(stid);
13991400
return SCAP_FAILURE;
14001401
}
14011402
*suppressed = true;

0 commit comments

Comments
 (0)