Skip to content

Commit

Permalink
fix syscall arg errors reported by valgrind
Browse files Browse the repository at this point in the history
... when running with empty .ini file.
  • Loading branch information
kfish committed Apr 20, 2010
1 parent 60d1835 commit 6eeaf6c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/libblossom/blossom.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ blossom_open (BlossomConfig * config, const char * path, const char * flavour)
if (path == NULL)
p = getcwd(NULL, 0);

blossom = (Blossom *) malloc (sizeof (Blossom));
blossom = (Blossom *) calloc (1, sizeof (Blossom));

/* Attach config */
blossom->config = config;
Expand Down
2 changes: 2 additions & 0 deletions src/libblossom/flavour.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ blossom_slurp_content_type (Blossom * blossom)
#endif

path = blossom->template_files[BLOSSOM_TEMPLATE_CONTENT_TYPE];
if (path == NULL)
return -1;

if (stat (path, &statbuf) == -1)
return -1;
Expand Down
4 changes: 2 additions & 2 deletions src/libblossom/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ blossom_path_new (const char * path1, const char * path2)

s = new_path = (char *) malloc (len);

if (path1) {
if (path1 && l1>0) {
strncpy (s, path1, l1);
s += l1;

Expand All @@ -34,7 +34,7 @@ blossom_path_new (const char * path1, const char * path2)
s++;
}

if (path2) {
if (path2 && l2>0) {
strncpy (s, path2, l2);
s += l2;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libblossom/template.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ blossom_template_set (Blossom * blossom, BlossomTemplate template)
{
blossom->template_current = template;

if (template == BLOSSOM_TEMPLATE_END)
if (template == BLOSSOM_TEMPLATE_END || blossom->template_files[template] == NULL)
blossom->template_fd = -1;
else
blossom->template_fd = open (blossom->template_files[template], O_RDONLY);
Expand Down

0 comments on commit 6eeaf6c

Please sign in to comment.