mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-27 09:30:13 +03:00
Create a function to free a csync_file_stat
This commit is contained in:
parent
270e06a99b
commit
1c9fa48d60
3 changed files with 16 additions and 10 deletions
15
src/csync.c
15
src/csync.c
|
@ -699,10 +699,7 @@ static void _tree_destructor(void *data) {
|
|||
csync_file_stat_t *freedata = NULL;
|
||||
|
||||
freedata = (csync_file_stat_t *) data;
|
||||
SAFE_FREE(freedata->md5);
|
||||
SAFE_FREE(freedata->destpath);
|
||||
SAFE_FREE(freedata->error_string);
|
||||
SAFE_FREE(freedata);
|
||||
csync_file_stat_free(freedata);
|
||||
}
|
||||
|
||||
static int _merge_and_write_statedb(CSYNC *ctx) {
|
||||
|
@ -1226,4 +1223,14 @@ int csync_abort_requested(CSYNC *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
void csync_file_stat_free(csync_file_stat_t *st)
|
||||
{
|
||||
if (st) {
|
||||
SAFE_FREE(st->md5);
|
||||
SAFE_FREE(st->error_string);
|
||||
SAFE_FREE(st->destpath);
|
||||
SAFE_FREE(st);
|
||||
}
|
||||
}
|
||||
|
||||
/* vim: set ts=8 sw=2 et cindent: */
|
||||
|
|
|
@ -198,6 +198,8 @@ __attribute__ ((packed))
|
|||
#endif
|
||||
;
|
||||
|
||||
void csync_file_stat_free(csync_file_stat_t *st);
|
||||
|
||||
/*
|
||||
* context for the treewalk function
|
||||
*/
|
||||
|
|
|
@ -230,8 +230,7 @@ out:
|
|||
}
|
||||
ctx->current_fs = st;
|
||||
|
||||
if( tmp) SAFE_FREE(tmp->md5);
|
||||
SAFE_FREE(tmp);
|
||||
csync_file_stat_free(tmp);
|
||||
st->inode = fs->inode;
|
||||
st->mode = fs->mode;
|
||||
st->size = fs->size;
|
||||
|
@ -305,10 +304,8 @@ int csync_walker(CSYNC *ctx, const char *file, const csync_vio_file_stat_t *fs,
|
|||
if( !st ) {
|
||||
return 0;
|
||||
}
|
||||
SAFE_FREE(st->md5);
|
||||
SAFE_FREE(st->destpath);
|
||||
SAFE_FREE(st->error_string);
|
||||
SAFE_FREE(st);
|
||||
csync_file_stat_free(st);
|
||||
st = NULL;
|
||||
|
||||
type = CSYNC_FTW_TYPE_SKIP;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue