Avoid a crash when res_timing_dahdi is unloaded but wasn't properly loaded.
authorEliel C. Sardanons <eliels@gmail.com>
Sun, 31 May 2009 01:22:15 +0000 (01:22 +0000)
committerEliel C. Sardanons <eliels@gmail.com>
Sun, 31 May 2009 01:22:15 +0000 (01:22 +0000)
if dahdi_test_timer() fails, timing_funcs_handle remains NULL causing a crash
when calling ast_unregister_timing_interface() with a NULL pointer.

(closes issue #15234)
Reported by: eliel
Patches:
      timing_dahdi1.diff uploaded by eliel (license 64)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@198437 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_timing_dahdi.c

index bc65bbd..ae95cf9 100644 (file)
@@ -192,7 +192,11 @@ static int load_module(void)
 
 static int unload_module(void)
 {
-       return ast_unregister_timing_interface(timing_funcs_handle);
+       if (timing_funcs_handle) {
+               return ast_unregister_timing_interface(timing_funcs_handle);
+       }
+
+       return 0;
 }
 
 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "DAHDI Timing Interface");