Skip to contentSkip to conversation

alarm.c: don't pass a null pointer to pthread_attr_destroy

PATCH New Jeff Moyer 1 participant 1 message Sep 4, 2009

Subsystems (2)
lore
Share & tools
lore

Jeff Moyer

author
#0 lore raw

PATCH 1/1 alarm.c: don't pass a null pointer to pthread_attr_destroy

Hi, Ian,

Here's another variant of the null pointer passed to attr_destroy.

Cheers,
Jeff

lib/alarm.c +2 -1
index 46df38a..f403d8f 100755
@@ -239,7 +239,8 @@ int alarm_start_handler(void)
 
 	status = pthread_create(&thid, pattrs, alarm_handler, NULL);
 
-	pthread_attr_destroy(pattrs);
+	if (pattrs)
+		pthread_attr_destroy(pattrs);
 
 	return !status;
 }