]> granicus.if.org Git - zfs/commitdiff
Fix memory leak in recv_skip
authorluozhengzheng <luo.zhengzheng@zte.com.cn>
Tue, 11 Oct 2016 17:24:18 +0000 (01:24 +0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 11 Oct 2016 17:24:18 +0000 (10:24 -0700)
When the exception branch exits, the buf is leaked.

Reviewed by: Richard Laager <rlaager@wiktel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: luozhengzheng <luo.zhengzheng@zte.com.cn>
Closes #5262

lib/libzfs/libzfs_sendrecv.c

index ff84a1acdb4309d72e6d9fe0158a0ba43626c897..55131369e0491b49a076633123e2b1d6daa12cbe 100644 (file)
@@ -3025,6 +3025,7 @@ recv_skip(libzfs_handle_t *hdl, int fd, boolean_t byteswap)
                default:
                        zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
                            "invalid record type"));
+                       free(buf);
                        return (zfs_error(hdl, EZFS_BADSTREAM, errbuf));
                }
        }