aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2003-10-14 19:18:27 +0000
committerJason Woodward2003-10-14 19:18:27 +0000
commitd0faf328882a4e3507d2d980a61af41c96ae0c0d (patch)
tree196ec51107645daf4a8100e787478c469d62295f
parent7de4c6c209b8b9c0b0a094ef19378dcf89a1e0cf (diff)
downloadslapt-get-d0faf328882a4e3507d2d980a61af41c96ae0c0d.tar.gz
fixed string bug with --install and --remove
-rw-r--r--src/main.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 5ae4567..bd1477e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -127,8 +127,8 @@ int main( int argc, char *argv[] ){
paa->pkgs = malloc( sizeof *paa->pkgs * (argc - optind) );
paa->count = 0;
while (optind < argc){
- paa->pkgs[paa->count] = malloc(
- sizeof *paa->pkgs[paa->count] * ( strlen(argv[optind]) + 1 )
+ paa->pkgs[paa->count] = calloc(
+ sizeof *paa->pkgs[paa->count] , ( strlen(argv[optind]) + 1 )
);
memcpy(paa->pkgs[paa->count],argv[optind],strlen(argv[optind]));
++optind;
@@ -152,8 +152,8 @@ int main( int argc, char *argv[] ){
paa->pkgs = malloc( sizeof *paa->pkgs * (argc - optind) );
paa->count = 0;
while (optind < argc){
- paa->pkgs[paa->count] = malloc(
- sizeof *paa->pkgs[paa->count] * ( strlen(argv[optind]) + 1 )
+ paa->pkgs[paa->count] = calloc(
+ sizeof *paa->pkgs[paa->count] , ( strlen(argv[optind]) + 1 )
);
memcpy(paa->pkgs[paa->count],argv[optind],strlen(argv[optind]));
++optind;