summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pacman/pacman.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 9ed1c612..cd59c8d4 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -721,15 +721,18 @@ static void cl_to_log(int argc, char* argv[])
{
size_t size = 0;
int i;
- for(i = 0; i<argc; i++) {
+ for(i = 0; i < argc; i++) {
size += strlen(argv[i]) + 1;
}
+ if(!size) {
+ return;
+ }
char *cl_text = malloc(size);
if(!cl_text) {
return;
}
char *p = cl_text;
- for(i = 0; i<argc-1; i++) {
+ for(i = 0; i < argc - 1; i++) {
strcpy(p, argv[i]);
p += strlen(argv[i]);
*p++ = ' ';