Sat Jan 23 23:08:03 2010 UTC ()
nbpatch-20100124: Fix a memory leak.


(joerg)
diff -r1.4 -r1.5 pkgsrc/devel/nbpatch/Makefile
diff -r1.3 -r1.4 pkgsrc/devel/nbpatch/files/util.c

cvs diff -r1.4 -r1.5 pkgsrc/devel/nbpatch/Makefile (expand / switch to unified diff)

--- pkgsrc/devel/nbpatch/Makefile 2009/10/21 17:17:04 1.4
+++ pkgsrc/devel/nbpatch/Makefile 2010/01/23 23:08:03 1.5
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1# $NetBSD: Makefile,v 1.4 2009/10/21 17:17:04 joerg Exp $ 1# $NetBSD: Makefile,v 1.5 2010/01/23 23:08:03 joerg Exp $
2# 2#
3 3
4DISTNAME= nbpatch-20091021 4DISTNAME= nbpatch-20100124
5CATEGORIES= devel 5CATEGORIES= devel
6MASTER_SITES= # empty 6MASTER_SITES= # empty
7DISTFILES= # empty 7DISTFILES= # empty
8 8
9MAINTAINER= joerg@NetBSD.org 9MAINTAINER= joerg@NetBSD.org
10HOMEPAGE= http://www.pkgsrc.org/ 10HOMEPAGE= http://www.pkgsrc.org/
11COMMENT= Patch files using diff output 11COMMENT= Patch files using diff output
12 12
13PKG_DESTDIR_SUPPORT= user-destdir 13PKG_DESTDIR_SUPPORT= user-destdir
14 14
15# Allow checkperms and othher core dependencies to use patches 15# Allow checkperms and othher core dependencies to use patches
16CHECK_PERMS= no 16CHECK_PERMS= no
17 17

cvs diff -r1.3 -r1.4 pkgsrc/devel/nbpatch/files/util.c (expand / switch to unified diff)

--- pkgsrc/devel/nbpatch/files/util.c 2009/05/09 20:09:33 1.3
+++ pkgsrc/devel/nbpatch/files/util.c 2010/01/23 23:08:03 1.4
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1/* 1/*
2 * $OpenBSD: util.c,v 1.32 2006/03/11 19:41:30 otto Exp $ 2 * $OpenBSD: util.c,v 1.32 2006/03/11 19:41:30 otto Exp $
3 * $DragonFly: src/usr.bin/patch/util.c,v 1.9 2007/09/29 23:11:10 swildner Exp $ 3 * $DragonFly: src/usr.bin/patch/util.c,v 1.9 2007/09/29 23:11:10 swildner Exp $
4 * $NetBSD: util.c,v 1.3 2009/05/09 20:09:33 joerg Exp $ 4 * $NetBSD: util.c,v 1.4 2010/01/23 23:08:03 joerg Exp $
5 */ 5 */
6 6
7/* 7/*
8 * patch - a program to apply diffs to original files 8 * patch - a program to apply diffs to original files
9 *  9 *
10 * Copyright 1986, Larry Wall 10 * Copyright 1986, Larry Wall
11 *  11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following condition is met: 13 * modification, are permitted provided that the following condition is met:
14 * 1. Redistributions of source code must retain the above copyright notice, 14 * 1. Redistributions of source code must retain the above copyright notice,
15 * this condition and the following disclaimer. 15 * this condition and the following disclaimer.
16 *  16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
@@ -317,28 +317,30 @@ ignore_signals(void) @@ -317,28 +317,30 @@ ignore_signals(void)
317 * true, ignore the last element of `filename'. 317 * true, ignore the last element of `filename'.
318 */ 318 */
319 319
320void 320void
321makedirs(const char *filename, bool striplast) 321makedirs(const char *filename, bool striplast)
322{ 322{
323 char *tmpbuf; 323 char *tmpbuf;
324 324
325 if ((tmpbuf = strdup(filename)) == NULL) 325 if ((tmpbuf = strdup(filename)) == NULL)
326 fatal("out of memory\n"); 326 fatal("out of memory\n");
327 327
328 if (striplast) { 328 if (striplast) {
329 char *s = strrchr(tmpbuf, '/'); 329 char *s = strrchr(tmpbuf, '/');
330 if (s == NULL) 330 if (s == NULL) {
 331 free(tmpbuf);
331 return; /* nothing to be done */ 332 return; /* nothing to be done */
 333 }
332 *s = '\0'; 334 *s = '\0';
333 } 335 }
334 if (mkpath(tmpbuf) != 0) 336 if (mkpath(tmpbuf) != 0)
335 pfatal("creation of %s failed", tmpbuf); 337 pfatal("creation of %s failed", tmpbuf);
336 free(tmpbuf); 338 free(tmpbuf);
337} 339}
338 340
339/* 341/*
340 * Make filenames more reasonable. 342 * Make filenames more reasonable.
341 */ 343 */
342char * 344char *
343fetchname(const char *at, bool *exists, int strip_leading) 345fetchname(const char *at, bool *exists, int strip_leading)
344{ 346{