]> granicus.if.org Git - python/commitdiff
Don't call memset() before checking that the ptr is not NULL.
authorArmin Rigo <arigo@tunes.org>
Tue, 20 Sep 2005 18:07:47 +0000 (18:07 +0000)
committerArmin Rigo <arigo@tunes.org>
Tue, 20 Sep 2005 18:07:47 +0000 (18:07 +0000)
Python/thread_pthread.h

index a415a434bee8a076e41d96f95b044a4b1578a192..781467f84bed69c25a968426a2f3e1b658b2d5f7 100644 (file)
@@ -355,8 +355,8 @@ PyThread_allocate_lock(void)
                PyThread_init_thread();
 
        lock = (pthread_lock *) malloc(sizeof(pthread_lock));
-       memset((void *)lock, '\0', sizeof(pthread_lock));
        if (lock) {
+               memset((void *)lock, '\0', sizeof(pthread_lock));
                lock->locked = 0;
 
                status = pthread_mutex_init(&lock->mut,