maximilian attems
2010-Nov-14 10:48 UTC
[klibc] [PATCH 1/2] cpio: remove useless if before free
Signed-off-by: maximilian attems <max at stro.at> --- usr/utils/cpio.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/usr/utils/cpio.c b/usr/utils/cpio.c index 174d362..e9cd0b4 100644 --- a/usr/utils/cpio.c +++ b/usr/utils/cpio.c @@ -365,8 +365,7 @@ add_inode(unsigned long node_num, char *file_name, unsigned long major_num, for (i = 0; i < hash_num; i++) hash_insert(old_table[i]); - if (old_table != NULL) - free(old_table); + free(old_table); } /* Insert the new record and increment the count of elements in the @@ -914,8 +913,7 @@ static void read_in_new_ascii(struct new_cpio_header *file_hdr, int in_des) ah += 8; } /* Read file name from input. */ - if (file_hdr->c_name != NULL) - free(file_hdr->c_name); + free(file_hdr->c_name); file_hdr->c_name = (char *)xmalloc(file_hdr->c_namesize); tape_buffered_read(file_hdr->c_name, in_des, (long)file_hdr->c_namesize); -- 1.7.2.3
maximilian attems
2010-Nov-14 10:48 UTC
[klibc] [PATCH 2/2] nfsmounf: start_dummy_portmap() close fd on error path
fix ressource leakage. Signed-off-by: maximilian attems <max at stro.at> --- usr/kinit/nfsmount/dummypmap.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/usr/kinit/nfsmount/dummypmap.c b/usr/kinit/nfsmount/dummypmap.c index 43abe37..e5ebef9 100644 --- a/usr/kinit/nfsmount/dummypmap.c +++ b/usr/kinit/nfsmount/dummypmap.c @@ -249,6 +249,7 @@ pid_t start_dummy_portmap(const char *file) if (errno == EINVAL || errno == EADDRINUSE) return 0; /* Assume not needed */ else { + fclose(portmap_filep); fprintf(stderr, "%s: portmap spoofing failed\n", progname); return -1; @@ -257,6 +258,7 @@ pid_t start_dummy_portmap(const char *file) spoof_portmap = fork(); if (spoof_portmap == -1) { + fclose(portmap_filep); fprintf(stderr, "%s: cannot fork\n", progname); return -1; } else if (spoof_portmap == 0) { -- 1.7.2.3