Commits

Anonymous committed ca08111 Merge

am 9ca4088e: android.c: fix free of uninitialized memory

* commit '9ca4088ee4d8378e9f01df67a8df3f0cb5071bed':
android.c: fix free of uninitialized memory

Comments (0)

Files changed (1)

 				const char *seinfo,
 				uid_t uid)
 {
-	char *orig_ctx_str = NULL, *ctx_str;
+	char *orig_ctx_str = NULL;
+	char *ctx_str = NULL;
 	context_t ctx = NULL;
-	int rc;
+	int rc = -1;
 
 	if (is_selinux_enabled() <= 0)
 		return 0;
 {
 	char *orig_ctx_str = NULL, *ctx_str;
 	context_t ctx = NULL;
-	int rc;
+	int rc = -1;
 
 	if (is_selinux_enabled() <= 0)
 		return 0;
 int selinux_android_restorecon(const char *pathname)
 {
 
+	char* oldcontext = NULL;
+	char* newcontext = NULL;
+	struct stat sb;
+	int ret = -1;
+
 	if (is_selinux_enabled() <= 0)
 		return 0;
 
 	__selinux_once(fc_once, file_context_init);
 
-	int ret;
-
 	if (!sehandle)
 		goto bail;
 
-	struct stat sb;
-
 	if (lstat(pathname, &sb) < 0)
 		goto err;
 
-	char *oldcontext, *newcontext;
-
 	if (lgetfilecon(pathname, &oldcontext) < 0)
 		goto err;