]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- fix memory leak 740/head
authorArvin Schnell <aschnell@suse.de>
Mon, 8 Aug 2022 09:48:56 +0000 (11:48 +0200)
committerArvin Schnell <aschnell@suse.de>
Mon, 8 Aug 2022 09:48:56 +0000 (11:48 +0200)
pam/pam_snapper.c

index 3f33587f0bbee02b6ad4a19d28a6375243824549..21e6b04e635e3b279cfa9fb79ee63c3e10b29f12 100644 (file)
@@ -531,9 +531,11 @@ static int get_ugid( pam_handle_t * pamh, const char *pam_user, uid_t * uid, gid
 
        int e;
        while ( ( e = getpwnam_r( pam_user, &pwd, buf, bufsize, &result ) ) == ERANGE ) {
+               free( buf );
+
                bufsize *= 2;
-               buf = realloc( buf, bufsize );
 
+               buf = malloc( bufsize );
                if ( !buf ) {
                        pam_syslog( pamh, LOG_ERR, "out of memory" );
                        return -1;