diff options
author | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-12-12 23:45:36 +0000 |
---|---|---|
committer | andersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-12-12 23:45:36 +0000 |
commit | 253b2d21eb504da38b365ffd3213976fc017e37a (patch) | |
tree | 8c0b218f0ea3f30822a66001ce72bdfe669d825f /sh.c | |
parent | f8c0bb23056161c2036a7a3713394782b471689c (diff) | |
download | busybox-w32-253b2d21eb504da38b365ffd3213976fc017e37a.tar.gz busybox-w32-253b2d21eb504da38b365ffd3213976fc017e37a.tar.bz2 busybox-w32-253b2d21eb504da38b365ffd3213976fc017e37a.zip |
Mem leak fix from Matt Kraai
git-svn-id: svn://busybox.net/trunk/busybox@1441 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'sh.c')
-rw-r--r-- | sh.c | 6 |
1 files changed, 1 insertions, 5 deletions
@@ -663,7 +663,7 @@ static int setupRedirections(struct childProgram *prog) | |||
663 | 663 | ||
664 | static int getCommand(FILE * source, char *command) | 664 | static int getCommand(FILE * source, char *command) |
665 | { | 665 | { |
666 | char *user,buf[255],*s; | 666 | char user[9],buf[255],*s; |
667 | 667 | ||
668 | if (source == NULL) { | 668 | if (source == NULL) { |
669 | if (local_pending_command) { | 669 | if (local_pending_command) { |
@@ -678,7 +678,6 @@ static int getCommand(FILE * source, char *command) | |||
678 | 678 | ||
679 | /* get User Name and setup prompt */ | 679 | /* get User Name and setup prompt */ |
680 | strcpy(prompt,( geteuid() != 0 ) ? "$ ":"# "); | 680 | strcpy(prompt,( geteuid() != 0 ) ? "$ ":"# "); |
681 | user=xcalloc(sizeof(int), 9); | ||
682 | my_getpwuid(user, geteuid()); | 681 | my_getpwuid(user, geteuid()); |
683 | 682 | ||
684 | /* get HostName */ | 683 | /* get HostName */ |
@@ -723,9 +722,6 @@ static int getCommand(FILE * source, char *command) | |||
723 | #endif | 722 | #endif |
724 | } | 723 | } |
725 | 724 | ||
726 | /* don't leak memory */ | ||
727 | free(user); | ||
728 | |||
729 | if (!fgets(command, BUFSIZ - 2, source)) { | 725 | if (!fgets(command, BUFSIZ - 2, source)) { |
730 | if (source == stdin) | 726 | if (source == stdin) |
731 | printf("\n"); | 727 | printf("\n"); |