Bug 45086 - (reslist_cleanup.c) A potential bug discovered by a static program analysis approach
Summary: (reslist_cleanup.c) A potential bug discovered by a static program analysis a...
Status: RESOLVED FIXED
Alias: None
Product: APR
Classification: Unclassified
Component: APR-util (show other bugs)
Version: HEAD
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache Portable Runtime bugs mailinglist
URL:
Keywords: FixedInTrunk
Depends on:
Blocks:
 
Reported: 2008-05-27 22:04 UTC by Raymond
Modified: 2008-05-28 23:37 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Raymond 2008-05-27 22:04:40 UTC
File Name: /srclib/apr-util/misc/apr_reslist.c
Function Name: reslist_cleanup()
Buggy Code:

   144:     apr_thread_mutex_lock(rl->listlock);
   145: 
   146:     while (rl->nidle > 0) {
   147:         res = pop_resource(rl);
   148:         rl->ntotal--;
   149:         rv = destroy_resource(rl, res);
   150:         if (rv != APR_SUCCESS) 
   151:             return rv; 
             // the execution of apr_thread_mutex_unlock() is missed. 

Description: We found a rule requiring that apr_thread_mutex_unlock() be called after the execution of apr_thread_mutex_lock(). The call of apr_thread_mutex_unlock() is missed in the above code.
Comment 1 Nick Kew 2008-05-27 22:57:50 UTC
Please select the correct project, component, platform and OS when creating a bug report.
Comment 2 Raymond 2008-05-28 06:25:22 UTC
(In reply to comment #1)
> Please select the correct project, component, platform and OS when creating a
> bug report.


In our research project, we develop an approach to discover potential software defects from source code directly by using static program analysis and data mining techniques. In other words, the approach is able to detect potential software defects before the application is deployed. Therefore, this reported bug is not a run-time bug so that I don't have information about the project, component, platform and OS which this bug may be involved in. We would like to know whether this potential bug is a real bug in the source code. 

(Actually, some bugs discovered by our approach have been confirmed by Apache developers recently).   
Comment 3 Nick Kew 2008-05-28 07:16:37 UTC
Last time you reported bugs (and non-bugs), you posted to the mailinglist.  Given your approach, that was a sensible thing to do.

This is a genuine bug, too - thank you.  But you reported it (and two others, which I haven't looked at because they're probably inconsequential) in the wrong place.
Comment 4 Raymond 2008-05-28 08:26:30 UTC
(In reply to comment #3)
> Last time you reported bugs (and non-bugs), you posted to the mailinglist. 
> Given your approach, that was a sensible thing to do.
> This is a genuine bug, too - thank you.  But you reported it (and two others,
> which I haven't looked at because they're probably inconsequential) in the
> wrong place.


Your quick reply is appreciated. Your opinions on two others are important to our research. Please let me know if you have looked at two others. Thanks a lot! 
Comment 5 Nick Kew 2008-05-28 13:02:35 UTC
Fixed in trunk in r661063.
Will backport if noone screams.
Comment 6 Nick Kew 2008-05-28 23:37:58 UTC
fixed for forthcoming release