]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added some error checks.
authorGuido van Rossum <guido@python.org>
Sun, 20 Oct 1991 20:10:46 +0000 (20:10 +0000)
committerGuido van Rossum <guido@python.org>
Sun, 20 Oct 1991 20:10:46 +0000 (20:10 +0000)
Modules/almodule.c

index fad510d915b61e82442166159200ad6dbb49c96a..806ad75e630d33769732a4c282ebb366bc4e6f81 100644 (file)
@@ -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;
 }