Plug memory leaks and fix open(2) error check.

Reviewed by:	nwhitehorn
MFC after:	3 days
This commit is contained in:
Kevin Lo 2011-11-28 05:34:16 +00:00
parent a68d1eca2c
commit c725e3ef7a
3 changed files with 3 additions and 1 deletions

View File

@ -49,6 +49,7 @@ main(void)
dists = calloc(ndists, sizeof(const char *));
if (dists == NULL) {
fprintf(stderr, "Out of memory!\n");
free(diststring);
return (1);
}

View File

@ -48,6 +48,7 @@ main(void)
urls = calloc(ndists, sizeof(const char *));
if (urls == NULL) {
fprintf(stderr, "Out of memory!\n");
free(diststring);
return (1);
}

View File

@ -301,7 +301,7 @@ gpart_bootcode(struct ggeom *gp)
return;
bootfd = open(bootcode, O_RDONLY);
if (bootfd <= 0) {
if (bootfd < 0) {
dialog_msgbox("Bootcode Error", strerror(errno), 0, 0,
TRUE);
return;