Skip to content

Commit 8bdec52

Browse files
committed
Merge branch 'ma/stop-progress-null-fix' into next
NULL dereference fix. * ma/stop-progress-null-fix: progress: don't dereference before checking for NULL
2 parents eab9523 + ac900fd commit 8bdec52

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

progress.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,12 @@ static void finish_if_sparse(struct progress *progress)
319319

320320
void stop_progress(struct progress **p_progress)
321321
{
322+
if (!p_progress)
323+
BUG("don't provide NULL to stop_progress");
324+
322325
finish_if_sparse(*p_progress);
323326

324-
if (p_progress && *p_progress) {
327+
if (*p_progress) {
325328
trace2_data_intmax("progress", the_repository, "total_objects",
326329
(*p_progress)->total);
327330

@@ -338,7 +341,12 @@ void stop_progress(struct progress **p_progress)
338341

339342
void stop_progress_msg(struct progress **p_progress, const char *msg)
340343
{
341-
struct progress *progress = *p_progress;
344+
struct progress *progress;
345+
346+
if (!p_progress)
347+
BUG("don't provide NULL to stop_progress_msg");
348+
349+
progress = *p_progress;
342350
if (!progress)
343351
return;
344352
*p_progress = NULL;

0 commit comments

Comments
 (0)