Tue Oct 28 16:54:11 2014 UTC ()
Fix invalid free in deletextattr FUSE handler

Do not free FUSE message on error as it was not allocated.


(manu)
diff -r1.76 -r1.77 src/lib/libperfuse/ops.c

cvs diff -r1.76 -r1.77 src/lib/libperfuse/ops.c (expand / switch to unified diff)

--- src/lib/libperfuse/ops.c 2014/10/11 04:19:38 1.76
+++ src/lib/libperfuse/ops.c 2014/10/28 16:54:11 1.77
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ops.c,v 1.76 2014/10/11 04:19:38 manu Exp $ */ 1/* $NetBSD: ops.c,v 1.77 2014/10/28 16:54:11 manu Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved. 4 * Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
5 *  5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 *  14 *
@@ -3623,19 +3623,21 @@ perfuse_node_deleteextattr(struct puffs_ @@ -3623,19 +3623,21 @@ perfuse_node_deleteextattr(struct puffs_
3623 return EPERM; 3623 return EPERM;
3624 3624
3625 node_ref(opc); 3625 node_ref(opc);
3626 3626
3627 ps = puffs_getspecific(pu); 3627 ps = puffs_getspecific(pu);
3628 attrname = perfuse_native_ns(attrns, attrname, fuse_attrname); 3628 attrname = perfuse_native_ns(attrns, attrname, fuse_attrname);
3629 attrnamelen = strlen(attrname) + 1; 3629 attrnamelen = strlen(attrname) + 1;
3630 3630
3631 pm = ps->ps_new_msg(pu, opc, FUSE_REMOVEXATTR, attrnamelen, pcr); 3631 pm = ps->ps_new_msg(pu, opc, FUSE_REMOVEXATTR, attrnamelen, pcr);
3632 np = _GET_INPAYLOAD(ps, pm, char *); 3632 np = _GET_INPAYLOAD(ps, pm, char *);
3633 (void)strlcpy(np, attrname, attrnamelen); 3633 (void)strlcpy(np, attrname, attrnamelen);
3634  3634
3635 error = xchg_msg(pu, opc, pm, NO_PAYLOAD_REPLY_LEN, wait_reply); 3635 error = xchg_msg(pu, opc, pm, NO_PAYLOAD_REPLY_LEN, wait_reply);
 3636 if (error != 0)
 3637 goto out;
3636  3638
3637 ps->ps_destroy_msg(pm); 3639 ps->ps_destroy_msg(pm);
3638 3640out:
3639 node_rele(opc); 3641 node_rele(opc);
3640 return error; 3642 return error;
3641} 3643}