diff options
author | Guido van Rossum <guido@python.org> | 1991-10-20 20:10:46 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1991-10-20 20:10:46 (GMT) |
commit | c0aab89d9694233cf962dc63395d4599acf35e37 (patch) | |
tree | f70a856a4aebbf8806caadeedc8c07216c62fbd8 | |
parent | a76fb5b653a195e7082b6b507a0cea1b3abcf86e (diff) | |
download | cpython-c0aab89d9694233cf962dc63395d4599acf35e37.zip cpython-c0aab89d9694233cf962dc63395d4599acf35e37.tar.gz cpython-c0aab89d9694233cf962dc63395d4599acf35e37.tar.bz2 |
Added some error checks.
-rw-r--r-- | Modules/almodule.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Modules/almodule.c b/Modules/almodule.c index fad510d..806ad75 100644 --- a/Modules/almodule.c +++ b/Modules/almodule.c @@ -423,8 +423,13 @@ al_openport (self, args) object *name, *dir; ALport port; ALconfig config = NULL; - int size = gettuplesize(args); + int size; + if (args == NULL || !is_tupleobject(args)) { + err_badarg(); + return NULL; + } + size = gettuplesize(args); if (size == 2) { if (!getstrstrarg (args, &name, &dir)) return NULL; @@ -440,6 +445,11 @@ al_openport (self, args) port = ALopenport(getstringvalue(name), getstringvalue(dir), config); + if (port == NULL) { + err_errno(RuntimeError); + return NULL; + } + return newportobject (port); } @@ -452,6 +462,10 @@ al_newconfig (self, args) if (!getnoarg (args)) return NULL; config = ALnewconfig (); + if (config == NULL) { + err_errno(RuntimeError); + return NULL; + } return newconfigobject (config); } @@ -523,6 +537,8 @@ doParams(args, func, modified) setlistitem(list, i, newintobject(PVbuffer[i])); } + DEL(PVbuffer); + INCREF(None); return None; } |