diff options
author | Daniel Stone <daniel@fooishbar.org> | 2006-10-29 03:52:11 +0300 |
---|---|---|
committer | Daniel Stone <daniels@endtroducing.fooishbar.org> | 2006-10-29 03:52:11 +0300 |
commit | 644ee2434a4e09f5baea00a486911f8c24b9a261 (patch) | |
tree | ee94b4a820156943a6e734bcebc20fb747588295 /hw/kdrive | |
parent | 738d2e88171bcce8782d670a1cda9a1d941d7977 (diff) |
kdrive: avoid null dereferences
Avoid jumping into NULL pointers for OS or card functions which do not
exist.
Diffstat (limited to 'hw/kdrive')
-rw-r--r-- | hw/kdrive/src/kdrive.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index f29fdb95f..b6ac0b0cf 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -281,7 +281,7 @@ KdSuspend (void) for (screen = card->screenList; screen; screen = screen->next) if (screen->mynum == card->selected && screen->pScreen) KdDisableScreen (screen->pScreen); - if (card->driver) + if (card->driver && card->cfuncs->restore) (*card->cfuncs->restore) (card); } KdDisableInput (); @@ -295,7 +295,8 @@ KdDisableScreens (void) KdSuspend (); if (kdEnabled) { - (*kdOsFuncs->Disable) (); + if (kdOsFuncs->Disable) + (*kdOsFuncs->Disable) (); kdEnabled = FALSE; } } @@ -353,7 +354,8 @@ KdEnableScreens (void) if (!kdEnabled) { kdEnabled = TRUE; - (*kdOsFuncs->Enable) (); + if (kdOsFuncs->Enable) + (*kdOsFuncs->Enable) (); } KdResume (); } @@ -373,9 +375,10 @@ AbortDDX(void) KdDisableScreens (); if (kdOsFuncs) { - if (kdEnabled) + if (kdEnabled && kdOsFuncs->Disable) (*kdOsFuncs->Disable) (); - (*kdOsFuncs->Fini) (); + if (kdOsFuncs->Fini) + (*kdOsFuncs->Fini) (); KdDoSwitchCmd ("stop"); } @@ -768,7 +771,8 @@ KdOsInit (KdOsFuncs *pOsFuncs) if (serverGeneration == 1) { KdDoSwitchCmd ("start"); - (*pOsFuncs->Init) (); + if (pOsFuncs->Init) + (*pOsFuncs->Init) (); } } } |