Fix memory leaks in error cases.
PR: 159011 Submitted by: Henning Petersen <henning.petersen@t-online.de> Approved by: re (kib) MFC after: 1 week
This commit is contained in:
parent
e5a0927394
commit
ae568477e7
@ -94,6 +94,7 @@ put_sbuf_line(const char *cs)
|
||||
;
|
||||
if (s - cs >= LINECHARS) {
|
||||
errmsg = "line too long";
|
||||
free(lp);
|
||||
return NULL;
|
||||
}
|
||||
len = s - cs;
|
||||
@ -102,6 +103,7 @@ put_sbuf_line(const char *cs)
|
||||
if (fseeko(sfp, (off_t)0, SEEK_END) < 0) {
|
||||
fprintf(stderr, "%s\n", strerror(errno));
|
||||
errmsg = "cannot seek temp file";
|
||||
free(lp);
|
||||
return NULL;
|
||||
}
|
||||
sfseek = ftello(sfp);
|
||||
@ -112,6 +114,7 @@ put_sbuf_line(const char *cs)
|
||||
sfseek = -1;
|
||||
fprintf(stderr, "%s\n", strerror(errno));
|
||||
errmsg = "cannot write temp file";
|
||||
free(lp);
|
||||
return NULL;
|
||||
}
|
||||
lp->len = len;
|
||||
|
Loading…
x
Reference in New Issue
Block a user