apps/srp.c:153: error: MEMORY_LEAK
  memory dynamically allocated to `return` by call to `app_malloc()` at line 140, column 12 is not reachable after line 153, column 5.
Showing all 25 steps of the trace


apps/srp.c:135:1: start of procedure update_index()
133.   }
134.   
135. > static int update_index(CA_DB *db, char **row)
136.   {
137.       char **irow;

apps/srp.c:140:5: 
138.       int i;
139.   
140. >     irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers");
141.       for (i = 0; i < DB_NUMBER; i++) {
142.           irow[i] = row[i];

apps/apps.c:976:1: start of procedure app_malloc()
  974.   }
  975.   
  976. > void* app_malloc(int sz, const char *what)
  977.   {
  978.       void *vp = OPENSSL_malloc(sz);

apps/apps.c:978:5: 
  976.   void* app_malloc(int sz, const char *what)
  977.   {
  978. >     void *vp = OPENSSL_malloc(sz);
  979.   
  980.       if (vp == NULL) {

crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
    118.   }
    119.   
    120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
    121.   {
    122.       void *ret = NULL;

crypto/mem.c:122:5: 
    120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    121.   {
    122. >     void *ret = NULL;
    123.   
    124.       if (num <= 0)

crypto/mem.c:124:9: Taking false branch
    122.       void *ret = NULL;
    123.   
    124.       if (num <= 0)
                   ^
    125.           return NULL;
    126.   

crypto/mem.c:127:5: 
    125.           return NULL;
    126.   
    127. >     allow_customize = 0;
    128.   #ifdef CRYPTO_MDEBUG
    129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
    135.       }
    136.   #else
    137. >     (void)file;
    138.       (void)line;
    139.       ret = malloc(num);

crypto/mem.c:138:5: 
    136.   #else
    137.       (void)file;
    138. >     (void)line;
    139.       ret = malloc(num);
    140.   #endif

crypto/mem.c:139:5: 
    137.       (void)file;
    138.       (void)line;
    139. >     ret = malloc(num);
    140.   #endif
    141.   

crypto/mem.c:154:5: 
    152.   #endif
    153.   
    154. >     return ret;
    155.   }
    156.   

crypto/mem.c:155:1: return from a call to CRYPTO_malloc
    153.   
    154.       return ret;
    155. > }
    156.   
    157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

apps/apps.c:980:9: Taking false branch
  978.       void *vp = OPENSSL_malloc(sz);
  979.   
  980.       if (vp == NULL) {
                 ^
  981.           BIO_printf(bio_err, "%s: Could not allocate %d bytes for %s\n",
  982.                   opt_getprog(), sz, what);

apps/apps.c:986:5: 
  984.           exit(1);
  985.       }
  986. >     return vp;
  987.   }
  988.   

apps/apps.c:987:1: return from a call to app_malloc
  985.       }
  986.       return vp;
  987. > }
  988.   
  989.   

apps/srp.c:141:10: 
139.   
140.       irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers");
141. >     for (i = 0; i < DB_NUMBER; i++) {
142.           irow[i] = row[i];
143.           row[i] = NULL;

apps/srp.c:141:17: Loop condition is true. Entering loop body
139.   
140.       irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers");
141.       for (i = 0; i < DB_NUMBER; i++) {
                       ^
142.           irow[i] = row[i];
143.           row[i] = NULL;

apps/srp.c:142:9: 
140.       irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers");
141.       for (i = 0; i < DB_NUMBER; i++) {
142. >         irow[i] = row[i];
143.           row[i] = NULL;
144.       }

apps/srp.c:143:9: 
141.       for (i = 0; i < DB_NUMBER; i++) {
142.           irow[i] = row[i];
143. >         row[i] = NULL;
144.       }
145.       irow[DB_NUMBER] = NULL;

apps/srp.c:141:32: 
139.   
140.       irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers");
141. >     for (i = 0; i < DB_NUMBER; i++) {
142.           irow[i] = row[i];
143.           row[i] = NULL;

apps/srp.c:141:17: Loop condition is false. Leaving loop
139.   
140.       irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers");
141.       for (i = 0; i < DB_NUMBER; i++) {
                       ^
142.           irow[i] = row[i];
143.           row[i] = NULL;

apps/srp.c:145:5: 
143.           row[i] = NULL;
144.       }
145. >     irow[DB_NUMBER] = NULL;
146.   
147.       if (!TXT_DB_insert(db->db, irow)) {

apps/srp.c:147:10: Taking false branch
145.       irow[DB_NUMBER] = NULL;
146.   
147.       if (!TXT_DB_insert(db->db, irow)) {
                ^
148.           BIO_printf(bio_err, "failed to update srpvfile\n");
149.           BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error);

apps/srp.c:153:5: 
151.           return 0;
152.       }
153. >     return 1;
154.   }
155.   

static int update_index(CA_DB *db, char **row)
{
    char **irow;
    int i;
    irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers");
    for (i = 0; i < DB_NUMBER; i++) {
        irow[i] = row[i];
        row[i] = NULL;
    }
    irow[DB_NUMBER] = NULL;
    if (!TXT_DB_insert(db->db, irow)) {
        BIO_printf(bio_err, "failed to update srpvfile\n");
        BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error);
        OPENSSL_free(irow);
        return 0;
    }
    return 1;
}
['static int update_index(CA_DB *db, char **row)\n{\n    char **irow;\n    int i;\n    irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers");\n    for (i = 0; i < DB_NUMBER; i++) {\n        irow[i] = row[i];\n        row[i] = NULL;\n    }\n    irow[DB_NUMBER] = NULL;\n    if (!TXT_DB_insert(db->db, irow)) {\n        BIO_printf(bio_err, "failed to update srpvfile\\n");\n        BIO_printf(bio_err, "TXT_DB error number %ld\\n", db->db->error);\n        OPENSSL_free(irow);\n        return 0;\n    }\n    return 1;\n}', 'void* app_malloc(int sz, const char *what)\n{\n    void *vp = OPENSSL_malloc(sz);\n    if (vp == NULL) {\n        BIO_printf(bio_err, "%s: Could not allocate %d bytes for %s\\n",\n                opt_getprog(), sz, what);\n        ERR_print_errors(bio_err);\n        exit(1);\n    }\n    return vp;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifdef CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}']