From: claudio Date: Mon, 17 May 2021 12:11:05 +0000 (+0000) Subject: Do not leak blk.blks in error condition. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8da8f61ed247714b20a480f36063daac4883b98b;p=openbsd Do not leak blk.blks in error condition. Noticed by and OK benno@ --- diff --git a/usr.bin/rsync/uploader.c b/usr.bin/rsync/uploader.c index 707e85f1338..85f200c3b59 100644 --- a/usr.bin/rsync/uploader.c +++ b/usr.bin/rsync/uploader.c @@ -1,4 +1,4 @@ -/* $Id: uploader.c,v 1.26 2021/05/17 11:49:01 claudio Exp $ */ +/* $Id: uploader.c,v 1.27 2021/05/17 12:11:05 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * Copyright (c) 2019 Florian Obser @@ -905,6 +905,7 @@ rsync_uploader(struct upload *u, int *fileinfd, ERR("malloc"); close(*fileinfd); *fileinfd = -1; + free(blk.blks); return -1; } @@ -917,6 +918,7 @@ rsync_uploader(struct upload *u, int *fileinfd, close(*fileinfd); *fileinfd = -1; free(mbuf); + free(blk.blks); return -1; } init_blk(&blk.blks[i], &blk, offs, i, mbuf, sess); @@ -959,6 +961,7 @@ rsync_uploader(struct upload *u, int *fileinfd, if (u->bufsz > u->bufmax) { if ((bufp = realloc(u->buf, u->bufsz)) == NULL) { ERR("realloc"); + free(blk.blks); return -1; } u->buf = bufp;