remote: use xstrdup() instead of strdup()
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Sep 15, 2011 at 23:10 UTC
c28cce55e0ea1d674ccc89cadadac0bfef511384
2 files changed
+3
-3
remote.c
+1
-1
@@ -815,7 +815,7 @@ char *apply_refspecs(struct refspec *refspecs, int nr_refspec,
815
refspec->dst, &ret))
816
return ret;
817
} else if (!strcmp(refspec->src, name))
818
- return strdup(refspec->dst);
818
+ return xstrdup(refspec->dst);
819
}
820
return NULL;
821
}
transport-helper.c
+2
-2
@@ -183,7 +183,7 @@ static struct child_process *get_helper(struct transport *transport)
183
ALLOC_GROW(refspecs,
184
refspec_nr + 1,
185
refspec_alloc);
186
- refspecs[refspec_nr++] = strdup(capname + strlen("refspec "));
186
+ refspecs[refspec_nr++] = xstrdup(capname + strlen("refspec "));
187
} else if (!strcmp(capname, "connect")) {
188
data->connect = 1;
189
} else if (!prefixcmp(capname, "export-marks ")) {
@@ -445,7 +445,7 @@ static int fetch_with_import(struct transport *transport,
445
if (data->refspecs)
446
private = apply_refspecs(data->refspecs, data->refspec_nr, posn->name);
447
else
448
- private = strdup(posn->name);
448
+ private = xstrdup(posn->name);
449
read_ref(private, posn->old_sha1);
450
free(private);
451
}