On Sat, 2009-01-24 at 16:47 +1100, Paul Wankadia wrote:
> modules/replicated.c:
>     303 static int add_host(struct host **list, struct host *host)
> ...
>     307         if (!list) {
>     308                 *list = host;
>     309                 return 1;
>     310         }
> 
> That is a NULL pointer dereference.

Oops!

> 
> 
> lib/alarm.c:
>     223 int alarm_start_handler(void)
> ...
>     230         status = pthread_attr_init(pattrs);
> ...
>     240         status = pthread_create(&thid, pattrs, alarm_handler,
> NULL);
>     241         if (status)
>     242                 return 0;
>     243 
>     244         return 1;
> 
> Should you call pthread_attr_destroy(3) before returning?

Yes, missed that as it used to use a global attributes.

> 
> 
> lib/defaults.c:
>     544 struct ldap_searchdn *defaults_get_searchdns(void)
> ...
>     566                         if (!new) {
>     567                                 defaults_free_searchdns(sdn);
>     568                                 return NULL;
>     569                         }
> 
> That is a resource leak. (`f' is not closed.)
> 
> 
> modules/mount_changer.c:
>     142 int swapCD(const char *device, const char *slotName)
> ...
>     161         if (total_slots_available <= 1) {
>     162                 logerr(MODPREFIX
>     163                       "Device %s is not an ATAPI compliant CD
> changer.",
>     164                       device);
>     165                 return 1;
>     166         }
> ...
>     170         if (slot < 0) {
>     171                 logerr(MODPREFIX "CDROM_SELECT_DISC failed");
>     172                 return 1;
>     173         }
> 
> Those are resource leaks. (`fd' is not closed.)

Great, obvious catches.

> 
> 
> daemon/state.c:
>    1124 int st_start_handler(void)
> ...
>    1131         status = pthread_attr_init(pattrs);
> ...
>    1141         status = pthread_create(&thid, pattrs,
> st_queue_handler, NULL);
>    1142         if (status)
>    1143                 return 0;
>    1144 
>    1145         return 1;
> 
> Should you call pthread_attr_destroy(3) before returning?


Yes, also missed that as it used to use a global attributes.

Ian

_______________________________________________
autofs mailing list
autofs@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/autofs

Reply via email to