Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/citrus/modules fix memory leak, pointed by nonaka-s...



details:   https://anonhg.NetBSD.org/src/rev/95db5e90870f
branches:  trunk
changeset: 771413:95db5e90870f
user:      tnozaki <tnozaki%NetBSD.org@localhost>
date:      Sat Nov 19 18:48:39 2011 +0000

description:
fix memory leak, pointed by nonaka-san(again^3).

diffstat:

 lib/libc/citrus/modules/citrus_mapper_std.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 5f57230be48d -r 95db5e90870f lib/libc/citrus/modules/citrus_mapper_std.c
--- a/lib/libc/citrus/modules/citrus_mapper_std.c       Sat Nov 19 18:43:40 2011 +0000
+++ b/lib/libc/citrus/modules/citrus_mapper_std.c       Sat Nov 19 18:48:39 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: citrus_mapper_std.c,v 1.9 2011/10/30 21:48:27 wiz Exp $        */
+/*     $NetBSD: citrus_mapper_std.c,v 1.10 2011/11/19 18:48:39 tnozaki Exp $   */
 
 /*-
  * Copyright (c)2003, 2006 Citrus Project,
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: citrus_mapper_std.c,v 1.9 2011/10/30 21:48:27 wiz Exp $");
+__RCSID("$NetBSD: citrus_mapper_std.c,v 1.10 2011/11/19 18:48:39 tnozaki Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <assert.h>
@@ -185,8 +185,11 @@
        n = be32toh(rcx->rcx_src_row_end);
        if (m + n > 0) {
                ret = set_linear_zone(lz, m, n);
-               if (ret != 0)
+               if (ret != 0) {
+                       free(rc->rc_src_rowcol);
+                       rc->rc_src_rowcol = NULL;
                        return ret;
+               }
                ++rc->rc_src_rowcol_len, ++lz;
        }
        m = be32toh(rcx->rcx_src_col_begin);



Home | Main Index | Thread Index | Old Index