hammer(8): Fix a wrong sizeof.
authorSascha Wildner <saw@online.de>
Sun, 17 Jun 2012 19:21:15 +0000 (21:21 +0200)
committerSascha Wildner <saw@online.de>
Sun, 17 Jun 2012 19:23:25 +0000 (21:23 +0200)
Use the size passed to the malloc() here.

Found-with: Coccinelle (http://coccinelle.lip6.fr/)

sbin/hammer/cmd_mirror.c

index f5930f0..eacc76a 100644 (file)
@@ -30,8 +30,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- *
- * $DragonFly: src/sbin/hammer/cmd_mirror.c,v 1.16 2008/11/09 05:22:56 dillon Exp $
  */
 
 #include "hammer.h"
@@ -493,7 +491,7 @@ generate_histogram(int fd, const char *filesystem,
 
        /* needs 2 extra */
        tid_bytes = malloc(sizeof(*tid_bytes) * (HIST_COUNT + 2));
-       bzero(tid_bytes, sizeof(tid_bytes));
+       bzero(tid_bytes, sizeof(*tid_bytes) * (HIST_COUNT + 2));
 
        if (*repeatp == 0) {
                fprintf(stderr, "Prescan to break up bulk transfer");