Coverity CID 2078, 2079, 2080: Plug memory leaks.
This commit is contained in:
parent
e90cb419e0
commit
5800a5519e
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pch.c,v 1.19 2003/07/30 08:51:04 itojun Exp $ */
|
||||
/* $NetBSD: pch.c,v 1.20 2006/04/09 19:03:32 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, Larry Wall
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: pch.c,v 1.19 2003/07/30 08:51:04 itojun Exp $");
|
||||
__RCSID("$NetBSD: pch.c,v 1.20 2006/04/09 19:03:32 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include "EXTERN.h"
|
||||
|
@ -259,24 +259,34 @@ intuit_diff_type(void)
|
|||
fcl_line = p_input_line;
|
||||
p_indent = indent; /* assume this for now */
|
||||
}
|
||||
if (!stars_last_line && strnEQ(s, "*** ", 4))
|
||||
if (!stars_last_line && strnEQ(s, "*** ", 4)) {
|
||||
if (oldtmp)
|
||||
free(oldtmp);
|
||||
oldtmp = xstrdup(s + 4);
|
||||
else if (strnEQ(s, "--- ", 4))
|
||||
} else if (strnEQ(s, "--- ", 4)) {
|
||||
if (newtmp)
|
||||
free(newtmp);
|
||||
newtmp = xstrdup(s + 4);
|
||||
else if (strnEQ(s, "+++ ", 4))
|
||||
} else if (strnEQ(s, "+++ ", 4)) {
|
||||
if (oldtmp)
|
||||
free(oldtmp);
|
||||
oldtmp = xstrdup(s + 4); /* pretend it is the old name */
|
||||
else if (strnEQ(s, "Index:", 6))
|
||||
} else if (strnEQ(s, "Index:", 6)) {
|
||||
if (indtmp)
|
||||
free(indtmp);
|
||||
indtmp = xstrdup(s + 6);
|
||||
else if (strnEQ(s, "Prereq:", 7)) {
|
||||
} else if (strnEQ(s, "Prereq:", 7)) {
|
||||
for (t = s + 7; isspace((unsigned char)*t); t++)
|
||||
;
|
||||
if (revision)
|
||||
free(revision);
|
||||
revision = xstrdup(t);
|
||||
for (t = revision;
|
||||
*t && !isspace((unsigned char)*t);
|
||||
t++)
|
||||
;
|
||||
*t = '\0';
|
||||
if (!*revision) {
|
||||
if (*revision == '\0') {
|
||||
free(revision);
|
||||
revision = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue