From ede17ba69d2e34f5e211a472e27102c16f2e6938 Mon Sep 17 00:00:00 2001 From: christos Date: Thu, 25 May 2006 00:19:27 +0000 Subject: [PATCH] Coverity CID 3322: Fix memory leak. --- usr.sbin/lpr/common_source/common.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/usr.sbin/lpr/common_source/common.c b/usr.sbin/lpr/common_source/common.c index 67d9b8913a7a..801fd6a97c9f 100644 --- a/usr.sbin/lpr/common_source/common.c +++ b/usr.sbin/lpr/common_source/common.c @@ -1,4 +1,4 @@ -/* $NetBSD: common.c,v 1.35 2006/03/21 22:47:26 christos Exp $ */ +/* $NetBSD: common.c,v 1.36 2006/05/25 00:19:27 christos Exp $ */ /* * Copyright (c) 1983, 1993 @@ -39,7 +39,7 @@ #if 0 static char sccsid[] = "@(#)common.c 8.5 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: common.c,v 1.35 2006/03/21 22:47:26 christos Exp $"); +__RCSID("$NetBSD: common.c,v 1.36 2006/05/25 00:19:27 christos Exp $"); #endif #endif /* not lint */ @@ -278,8 +278,10 @@ getq(struct queue **namelist[]) if (++nitems > arraysz) { nqueue = (struct queue **)realloc(queue, arraysz * 2 * sizeof(struct queue *)); - if (nqueue == NULL) + if (nqueue == NULL) { + free(q) goto errdone; + } (void)memset(&nqueue[arraysz], 0, arraysz * sizeof(struct queueue *)); queue = nqueue;