[Internal: merge sync-agent]
[platform/core/system/sync-agent.git] / src / framework / fsapi / operation.c
index 046b98b..0bdb036 100755 (executable)
@@ -1058,6 +1058,7 @@ int fs_file_md5_hashkey(const char *file_path, unsigned char **hash_key)
                ret = sync_agent_read_file(file_path, &required_contents, FS_BUFFER_SIZE, &read_file_size, &isFinal);
                if (ret != 1) {
                        _DEBUG_ERROR("sync_agent_read_file() Fail\n");
+                       ret = 0;
                        goto return_part;
                }
 
@@ -1083,8 +1084,17 @@ int fs_file_md5_hashkey(const char *file_path, unsigned char **hash_key)
        sync_agent_free_file(&required_contents);
 
        _EXTERN_FUNC_EXIT;
+       return ret;
 
  return_part:
+       if (real_md5_word != NULL) {
+               free(real_md5_word);
+               real_md5_word = NULL;
+       }
+       _DEBUG_INFO("Free Part");
+       sync_agent_free_file(&required_contents);
+
+       _EXTERN_FUNC_EXIT;
        return ret;
 }