diff --git a/usr.sbin/lpr/common_source/ctlinfo.c b/usr.sbin/lpr/common_source/ctlinfo.c index 9d2f310b1314..d1f828e5ed99 100644 --- a/usr.sbin/lpr/common_source/ctlinfo.c +++ b/usr.sbin/lpr/common_source/ctlinfo.c @@ -292,8 +292,10 @@ ctl_readcf(const char *ptrname, const char *cfname) msize = sroom2 + CTI_LINEMAX; msize = roundup(msize, 8); cstart = malloc(msize); - if (cstart == NULL) + if (cstart == NULL) { + fclose(cfile); return NULL; + } memset(cstart, 0, msize); cpriv = (struct cjprivate *)cstart; cpriv->pub.cji_priv = cpriv;