summaryrefslogtreecommitdiffstats
path: root/tests/c-api/test-create-handle.c
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-02-13 08:58:04 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-02-13 13:49:21 +0000
commitba443ae0486ae30ea597c4e126de63371f8fa7a8 (patch)
tree333ab9167181e587cf70ad46a973c34b7636e9e5 /tests/c-api/test-create-handle.c
parentc8a11468c4dc761acdcb9b184d345bafe1b5114d (diff)
downloadlibguestfs-ba443ae0486ae30ea597c4e126de63371f8fa7a8.tar.gz
libguestfs-ba443ae0486ae30ea597c4e126de63371f8fa7a8.tar.xz
libguestfs-ba443ae0486ae30ea597c4e126de63371f8fa7a8.zip
daemon: Don't xdr_free uninitialized args struct on error paths.
For stubs of functions that had arguments, code did this: static void mount_stub (XDR *xdr_in) { int r; struct guestfs_mount_args args; if (optargs_bitmask != 0) { //... goto done; } // possibly other tests here memset (&args, 0, sizeof args); [...] done: xdr_free ((xdrproc_t) xdr_guestfs_mount_args, (char *) &args); return; } This caused xdr_free to be called on uninitialized 'args' struct, causing a segfault. The fix is to add another label, so the code looks like: static void mount_stub (XDR *xdr_in) { int r; struct guestfs_mount_args args; if (optargs_bitmask != 0) { //... goto done_no_free; } // possibly other tests here memset (&args, 0, sizeof args); [...] done: xdr_free ((xdrproc_t) xdr_guestfs_mount_args, (char *) &args); done_no_free: return; } This fixes commit 330fbea5b2d6bd7db84f7ea7afe87cf1bcd438e0 and commit 0344248af55802bbbd816b349ec1ba9305996f6e.
Diffstat (limited to 'tests/c-api/test-create-handle.c')
0 files changed, 0 insertions, 0 deletions