Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37760227
en ru br
ALT Linux repos
S:2.27.0.2.ac1e-alt4
5.0: 2.15-alt2
4.1: 1.10-alt16
4.0: 1.10-alt16
3.0: 1.10-alt12

Group :: System/Libraries
RPM: libcap

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: libcap-1.10-alt-cap_free.patch
Download


2001-01-04  Dmitry V. Levin  <ldv@altlinux.org>
	* libcap/cap_alloc.c (cap_free): If data_p is NULL, do nothing,
	  to match free(3) behaviour.
	* libcap/cap_file.c (cap_get_fd): Fix cap_free usage.
	* libcap/cap_file.c (cap_get_file): Likewise.
	* libcap/cap_proc.c (cap_get_proc): Likewise.
	* libcap/cap_text.c (cap_from_text): Likewise.
diff -upr libcap-1.10.orig/libcap/cap_alloc.c libcap-1.10/libcap/cap_alloc.c
--- libcap-1.10.orig/libcap/cap_alloc.c	1999-11-18 10:23:24 +0300
+++ libcap-1.10/libcap/cap_alloc.c	2002-09-16 04:32:09 +0400
@@ -97,6 +97,8 @@ cap_t cap_dup(cap_t cap_d)
 
 int cap_free(void *data_p)
 {
+    if ( !data_p )
+	return 0;
 
     if ( good_cap_t(data_p) ) {
 	data_p = -1 + (__u32 *) data_p;
diff -upr libcap-1.10.orig/libcap/cap_file.c libcap-1.10/libcap/cap_file.c
--- libcap-1.10.orig/libcap/cap_file.c	1999-04-18 02:16:31 +0400
+++ libcap-1.10/libcap/cap_file.c	2002-09-16 04:23:48 +0400
@@ -29,7 +29,8 @@ cap_t cap_get_fd(int fildes)
 			      &result->set[CAP_INHERITABLE],
 			      &result->set[CAP_PERMITTED],
 			      &result->set[CAP_EFFECTIVE] )) {
-	    cap_free(&result);
+	    cap_free(result);
+	    result = NULL;
 	}
     }
 
@@ -54,7 +55,8 @@ cap_t cap_get_file(const char *filename)
 			     &result->set[CAP_INHERITABLE],
 			     &result->set[CAP_PERMITTED],
 			     &result->set[CAP_EFFECTIVE] ))
-	    cap_free(&result);
+	    cap_free(result);
+	    result = NULL;
     }
 
     return result;
diff -upr libcap-1.10.orig/libcap/cap_proc.c libcap-1.10/libcap/cap_proc.c
--- libcap-1.10.orig/libcap/cap_proc.c	1999-04-19 00:50:01 +0400
+++ libcap-1.10/libcap/cap_proc.c	2002-09-16 04:23:48 +0400
@@ -21,7 +21,8 @@ cap_t cap_get_proc(void)
 
 	/* fill the capability sets via a system call */
 	if (capget(&result->head, &result->set)) {
-	    cap_free(&result);
+	    cap_free(result);
+	    result = NULL;
 	}
     }
 
diff -upr libcap-1.10.orig/libcap/cap_text.c libcap-1.10/libcap/cap_text.c
--- libcap-1.10.orig/libcap/cap_text.c	1999-11-18 09:03:26 +0300
+++ libcap-1.10/libcap/cap_text.c	2002-09-16 04:30:09 +0400
@@ -209,9 +209,10 @@ cap_t cap_from_text(const char *str)
     }
 
 bad:
-    cap_free(&res);
+    cap_free(res);
+    res = NULL;
     errno = EINVAL;
-    return NULL;
+    return res;
 }
 
 /*
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin