vty: show subscriber: put() before printing the use count

Do not show the VTY command's own use count during 'show subscriber <ID>'.

When using 'show subscriber msisdn 2023', I was surprised to see a use count of
2 and suspected a use count leak. With 'show subscriber cache' however, the use
count is 1.

So I realized it is the vty command's own use count that makes it two, besides
the lu_complete=true one.

Change-Id: Id02b57b7ed299b010b9f8b9e809548eb1e6aa699
This commit is contained in:
Neels Hofmeyr 2018-12-12 04:02:29 +01:00 committed by Harald Welte
parent 4776b0526c
commit 14c6f3ee95
1 changed files with 5 additions and 2 deletions

View File

@ -832,10 +832,13 @@ DEFUN(show_subscr,
return CMD_WARNING;
}
subscr_dump_full_vty(vty, vsub);
/* In the vty output to the user, exclude this local use count added by vlr_subscr_get() in get_vsub_by_argv().
* This works, because: for get_vsub_by_argv() to succeed, there *must* have been at least one use count before
* this, and since this is not multi-threaded, this vlr_subscr_put() cannot possibly reach a count of 0. */
vlr_subscr_put(vsub);
subscr_dump_full_vty(vty, vsub);
return CMD_SUCCESS;
}