fetch.c: do not pass uninitialized lock to unlock_ref().
Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
May 31, 2006 at 15:23 UTC
99bd0f555823f3c3868561af33d85864a90a7d9a
1 file changed
+7
-4
fetch.c
+7
-4
@@ -203,7 +203,7 @@ static int mark_complete(const char *path, const unsigned char *sha1)
203
204
int pull(char *target)
205
{
206
- struct ref_lock *lock;
206
+ struct ref_lock *lock = NULL;
207
unsigned char sha1[20];
208
char *msg;
209
int ret;
@@ -223,15 +223,18 @@ int pull(char *target)
223
224
if (interpret_target(target, sha1)) {
225
error("Could not interpret %s as something to pull", target);
226
- unlock_ref(lock);
226
+ if (lock)
227
+ unlock_ref(lock);
228
return -1;
229
}
230
if (process(lookup_unknown_object(sha1))) {
230
- unlock_ref(lock);
231
+ if (lock)
232
+ unlock_ref(lock);
233
return -1;
234
}
235
if (loop()) {
234
- unlock_ref(lock);
236
+ if (lock)
237
+ unlock_ref(lock);
238
return -1;
239
}
240