Hej,

I was wondering about the following piece of code. It is part of the
find_home_dir procedure in shell.c.

2506: #if !defined(_WIN32) && !defined(WIN32) && !defined(__OS2__) &&
!defined(_WIN32_WCE) && !defined(__RTP__) && !defined(_WRS_KERNEL)
               struct passwd *pwent;
               uid_t uid = getuid();
               if( (pwent=getpwuid(uid)) != NULL) {
                       home_dir = pwent->pw_dir;
               }
2512: #endif

I think that pwent might be assigned with some allocated memory by the
call of getpwuid. If that is the case pwent is never freed and there
is a small memroy leak (I don't think this procedure is called that
often).

Now, I'm not sure if getpwuid actually allocates memory. Some
documentation does not mention anything about it; some mention it is not
possible; some mention that getpwuid can result in an ENOMEM
(allocation failed) error,
which clearly indicates that getpwuid tries to allocate some memory.
Since I'm not sure I thought I should ask the experts.

Cheers,
Ronald
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to