Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/sup/source plug memory leak. openbsd-pr-3416



details:   https://anonhg.NetBSD.org/src/rev/d1e3d25fa41d
branches:  trunk
changeset: 551007:d1e3d25fa41d
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed Aug 27 08:15:16 2003 +0000

description:
plug memory leak.  openbsd-pr-3416

diffstat:

 usr.sbin/sup/source/scmio.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r e3dd0080c708 -r d1e3d25fa41d usr.sbin/sup/source/scmio.c
--- a/usr.sbin/sup/source/scmio.c       Wed Aug 27 03:57:05 2003 +0000
+++ b/usr.sbin/sup/source/scmio.c       Wed Aug 27 08:15:16 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: scmio.c,v 1.14 2003/04/03 17:14:25 christos Exp $      */
+/*     $NetBSD: scmio.c,v 1.15 2003/08/27 08:15:16 itojun Exp $        */
 
 /*
  * Copyright (c) 1992 Carnegie Mellon University
@@ -617,15 +617,19 @@
                x = getcryptbuf(count + 1);
                if (x == SCMOK)
                        x = readdata(count, cryptbuf);
-               if (x != SCMOK)
+               if (x != SCMOK) {
+                       free(p);
                        return (x);
+               }
                if (scmdebug > 3)
                        printf("SCM Reading encrypted string %s\n", cryptbuf);
                decode(cryptbuf, p, count);
        } else {
                x = readdata(count, p);
-               if (x != SCMOK)
+               if (x != SCMOK) {
+                       free(p);
                        return (x);
+               }
        }
        p[count] = 0;           /* NULL at end of string */
        *buf = p;



Home | Main Index | Thread Index | Old Index