• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
  • Help
    • Online help
    • Learn Git
    • Welcome to Bitbucket
    • Keyboard shortcuts
  • Log In
Alexander Dahl
  1. Alexander Dahl

buildroot

Public
Actions
  • Clone
  • Compare

Learn more about cloning repositories

You have read-only access

Navigation
  • Source
  • Commits
  • Branches
  • All Branches Graph
  • Forks
  1. Alexander Dahl
  2. buildroot

Source

buildroot/package/python-pam/0002-nofree.patch
Peter KorsgaardPeter Korsgaard committed 848ef692ae403 Dec 2014
Raw file
Source viewDiff to previous
 
1
[PATCH] deallocate the conversation response only in case of error
2
​
3
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=679714
4
​
5
Downloaded from:
6
http://pkgs.fedoraproject.org/cgit/PyPAM.git/plain/PyPAM-0.5.0-nofree.patch
7
​
8
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
9
diff --git a/PAMmodule.c b/PAMmodule.c
10
index 03cb799..a7ff8a5 100644
11
--- a/PAMmodule.c
12
+++ b/PAMmodule.c
13
@@ -24,8 +24,6 @@ typedef struct {
14
     char                *service;
15
     char                *user;
16
     PyObject            *callback;
17
-    struct pam_response *response_data;
18
-    int                 response_len;
19
     PyObject            *user_data;
20
     void                *dlh1, *dlh2;
21
 } PyPAMObject;
22
@@ -54,15 +52,6 @@ static int PyPAM_conv(int num_msg, const struct pam_message **msg,
23
 
24
     Py_INCREF(self);
25
 
26
-    if (NULL != self->response_data) {
27
-        for (int i = 0; i < self->response_len; i++) {
28
-            free(self->response_data[0].resp);
29
-        }
30
-        free(self->response_data);
31
-        self->response_data = NULL;
32
-        self->response_len = 0;
33
-    }
34
-
35
     PyObject* msgList = PyList_New(num_msg);
36
     
37
     for (int i = 0; i < num_msg; i++) {
38
@@ -92,6 +81,10 @@ static int PyPAM_conv(int num_msg, const struct pam_message **msg,
39
         char* resp_text;
40
         int resp_retcode = 0;
41
         if (!PyArg_ParseTuple(respTuple, "si", &resp_text, &resp_retcode)) {
42
+            while (i > 0) {
43
+                free((--spr)->resp);
44
+                --i;
45
+            }
46
             free(*resp);
47
             Py_DECREF(respList);
48
             return PAM_CONV_ERR;
49
@@ -100,10 +93,6 @@ static int PyPAM_conv(int num_msg, const struct pam_message **msg,
50
         spr->resp_retcode = resp_retcode;
51
         Py_DECREF(respTuple);
52
     }
53
-    
54
-    // Save this so we can free it later.
55
-    self->response_data = *resp;
56
-    self->response_len = PyList_Size(respList);
57
 
58
     Py_DECREF(respList);
59
     
60
@@ -144,8 +133,6 @@ static PyObject * PyPAM_pam(PyObject *self, PyObject *args)
61
     p->user = NULL;
62
     Py_INCREF(Py_None);
63
     p->callback = Py_None;
  • Git repository management for enterprise teams powered by Atlassian Bitbucket
  • Atlassian Bitbucket v6.7.2
  • Documentation
  • Request a feature
  • About
  • Contact Atlassian
Atlassian

Everything looks good. We'll let you know here if there's anything you should know about.