openpam_readlinev.c (302408) | openpam_readlinev.c (348980) |
---|---|
1/*- | 1/*- |
2 * Copyright (c) 2012 Dag-Erling Sm��rgrav | 2 * Copyright (c) 2012-2016 Dag-Erling Sm��rgrav |
3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright --- 10 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright --- 10 unchanged lines hidden (view full) --- 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $Id: openpam_readlinev.c 648 2013-03-05 17:54:27Z des $ | 29 * $OpenPAM: openpam_readlinev.c 938 2017-04-30 21:34:42Z des $ |
30 */ 31 32#ifdef HAVE_CONFIG_H 33# include "config.h" 34#endif 35 36#include <errno.h> 37#include <stdio.h> --- 36 unchanged lines hidden (view full) --- 74 errno = ENOMEM; 75 break; 76 } 77 wordv = tmp; 78 } 79 /* insert our word */ 80 wordv[wordvlen++] = word; 81 wordv[wordvlen] = NULL; | 30 */ 31 32#ifdef HAVE_CONFIG_H 33# include "config.h" 34#endif 35 36#include <errno.h> 37#include <stdio.h> --- 36 unchanged lines hidden (view full) --- 74 errno = ENOMEM; 75 break; 76 } 77 wordv = tmp; 78 } 79 /* insert our word */ 80 wordv[wordvlen++] = word; 81 wordv[wordvlen] = NULL; |
82 word = NULL; |
|
82 } 83 if (errno != 0) { 84 /* I/O error or out of memory */ 85 serrno = errno; 86 while (wordvlen--) 87 free(wordv[wordvlen]); 88 free(wordv); | 83 } 84 if (errno != 0) { 85 /* I/O error or out of memory */ 86 serrno = errno; 87 while (wordvlen--) 88 free(wordv[wordvlen]); 89 free(wordv); |
90 free(word); |
|
89 errno = serrno; 90 return (NULL); 91 } 92 /* assert(!ferror(f)) */ 93 ch = fgetc(f); 94 /* assert(ch == EOF || ch == '\n') */ 95 if (ch == EOF && wordvlen == 0) { 96 free(wordv); --- 59 unchanged lines hidden --- | 91 errno = serrno; 92 return (NULL); 93 } 94 /* assert(!ferror(f)) */ 95 ch = fgetc(f); 96 /* assert(ch == EOF || ch == '\n') */ 97 if (ch == EOF && wordvlen == 0) { 98 free(wordv); --- 59 unchanged lines hidden --- |