Skip to content

Commit

Permalink
tools/nut-scanner/scan_snmp.c, scripts/valgrind/.valgrind.supp: const…
Browse files Browse the repository at this point in the history
…rain warnings about library methods [networkupstools#2511]

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Jul 10, 2024
1 parent ed87ed0 commit 47e8bd3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
8 changes: 8 additions & 0 deletions scripts/valgrind/.valgrind.supp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@
fun:init_snmp_once
...
}
{
<nut-scanner-snmp-sess_open>
Memcheck:Leak
fun:*alloc
...
fun:wrap_nut_snmp_sess_open
...
}
{
<nut-scanner-ipmi-ctxinit>
Memcheck:Leak
Expand Down
8 changes: 7 additions & 1 deletion tools/nut-scanner/scan_snmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,12 @@ static int init_session(struct snmp_session * snmp_sess, nutscan_snmp_t * sec)
return 1;
}

static void * wrap_nut_snmp_sess_open(struct snmp_session *session)
{
/* Open the session */
return (*nut_snmp_sess_open)(session); /* establish the session */
}

/* Performs a (parallel-able) SNMP protocol scan of one remote host.
* Returns NULL, updates global dev_ret when a scan is successful.
* FREES the caller's copy of "sec" and "peername" in it, if applicable.
Expand Down Expand Up @@ -951,7 +957,7 @@ static void * try_SysOID_thready(void * arg)
snmp_sess.timeout = (long)g_usec_timeout;

/* Open the session */
handle = (*nut_snmp_sess_open)(&snmp_sess); /* establish the session */
handle = wrap_nut_snmp_sess_open(&snmp_sess); /* establish the session */
if (handle == NULL) {
upsdebugx(2,
"Failed to open SNMP session for %s",
Expand Down

0 comments on commit 47e8bd3

Please sign in to comment.