Skip to content

Commit c28cce5

Browse files
mhaggergitster
authored andcommitted
remote: use xstrdup() instead of strdup()
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 313fb01 commit c28cce5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ char *apply_refspecs(struct refspec *refspecs, int nr_refspec,
815815
refspec->dst, &ret))
816816
return ret;
817817
} else if (!strcmp(refspec->src, name))
818-
return strdup(refspec->dst);
818+
return xstrdup(refspec->dst);
819819
}
820820
return NULL;
821821
}

transport-helper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static struct child_process *get_helper(struct transport *transport)
183183
ALLOC_GROW(refspecs,
184184
refspec_nr + 1,
185185
refspec_alloc);
186-
refspecs[refspec_nr++] = strdup(capname + strlen("refspec "));
186+
refspecs[refspec_nr++] = xstrdup(capname + strlen("refspec "));
187187
} else if (!strcmp(capname, "connect")) {
188188
data->connect = 1;
189189
} else if (!prefixcmp(capname, "export-marks ")) {
@@ -445,7 +445,7 @@ static int fetch_with_import(struct transport *transport,
445445
if (data->refspecs)
446446
private = apply_refspecs(data->refspecs, data->refspec_nr, posn->name);
447447
else
448-
private = strdup(posn->name);
448+
private = xstrdup(posn->name);
449449
read_ref(private, posn->old_sha1);
450450
free(private);
451451
}

0 commit comments

Comments
 (0)