Skip to content

Commit

Permalink
remote: use xstrdup() instead of strdup()
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Oct 5, 2011
1 parent 313fb01 commit c28cce5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion remote.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ char *apply_refspecs(struct refspec *refspecs, int nr_refspec,
refspec->dst, &ret))
return ret;
} else if (!strcmp(refspec->src, name))
return strdup(refspec->dst);
return xstrdup(refspec->dst);
}
return NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions transport-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ static struct child_process *get_helper(struct transport *transport)
ALLOC_GROW(refspecs,
refspec_nr + 1,
refspec_alloc);
refspecs[refspec_nr++] = strdup(capname + strlen("refspec "));
refspecs[refspec_nr++] = xstrdup(capname + strlen("refspec "));
} else if (!strcmp(capname, "connect")) {
data->connect = 1;
} else if (!prefixcmp(capname, "export-marks ")) {
Expand Down Expand Up @@ -445,7 +445,7 @@ static int fetch_with_import(struct transport *transport,
if (data->refspecs)
private = apply_refspecs(data->refspecs, data->refspec_nr, posn->name);
else
private = strdup(posn->name);
private = xstrdup(posn->name);
read_ref(private, posn->old_sha1);
free(private);
}
Expand Down

0 comments on commit c28cce5

Please sign in to comment.