Skip to content

Commit

Permalink
Fix segfault on missing "Filename:" from .zsync file
Browse files Browse the repository at this point in the history
  • Loading branch information
gianm committed Jan 18, 2012
1 parent 2808811 commit 724d0a1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion c/libzsync/zsync.c
Expand Up @@ -403,7 +403,8 @@ int zsync_blocksize(const struct zsync_state *zs) {
* Returns the suggested filename to be used for the final result of this
* zsync. Malloced string to be freed by the caller. */
char *zsync_filename(const struct zsync_state *zs) {
return strdup(zs->gzhead && zs->zfilename ? zs->zfilename : zs->filename);
char *p = zs->gzhead && zs->zfilename ? zs->zfilename : zs->filename;
return p ? strdup(p) : NULL;
}

off_t zsync_filelen(const struct zsync_state *zs) {
Expand Down

0 comments on commit 724d0a1

Please sign in to comment.