diff --git a/obexd/src/ftp.c b/obexd/src/ftp.c
index 413f1c4..4797df5 100644
--- a/obexd/src/ftp.c
+++ b/obexd/src/ftp.c
struct stat *dstat)
{
gchar perm[51], atime[18], ctime[18], mtime[18];
- gchar *escaped, *ret;
+ gchar *escaped, *ret = NULL;
snprintf(perm, 50, "user-perm=\"%s%s%s\" group-perm=\"%s%s%s\" "
"other-perm=\"%s%s%s\"",
if (S_ISDIR(fstat->st_mode))
ret = g_strdup_printf(FL_FOLDER_ELEMENT, escaped,
perm, atime, mtime, ctime);
- else
+ else if (S_ISREG(fstat->st_mode))
ret = g_strdup_printf(FL_FILE_ELEMENT, escaped, fstat->st_size,
perm, atime, mtime, ctime);