mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-31 10:05:31 +00:00
vshtabletest: Fix potential memleak
In testVshTableNew() we test whether vshTableNew(NULL) allocates a table. This is expected to fail (and return NULL), because passing nothing but NULL to vshTableNew() is viewed as error. Nevertheless, if vshTableNew() did not fail and returned an allocated table it would be leaked. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c196179b3b
commit
eb9bbde772
@ -33,7 +33,9 @@
|
||||
static int
|
||||
testVshTableNew(const void *opaque G_GNUC_UNUSED)
|
||||
{
|
||||
if (vshTableNew(NULL)) {
|
||||
g_autoptr(vshTable) table = vshTableNew(NULL);
|
||||
|
||||
if (table) {
|
||||
fprintf(stderr, "expected failure when passing null to vshTableNew\n");
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user